Runtime error when trying to pass varible to function it aborts plz help?
-
Runtime error when trying to pass varible to function it aborts plz help? this code appears to work for other people, but not me, I've tried everything and the people who can help me DON'T apparently when my program tries to pass the number variable to the "pass" function, by program aborts, if someone out there could be so kind to help me fix this problem I would greatly apprecaite it. Thnx. #include <iostream> #include <climits> #include <cstring> const char ssz = 77; const char osz = 21; void pass(short num); void pass(char* str); int main(void) { using std::cout; using std::cin; using std::endl; short number; restart: char* string = new char[ssz]; char option[osz]; cout << "Enter in \"number\" or \"string\" wether you want a string" << " to be passed to the\nfunciton or a number\n"; cin.getline(option, osz); if(strcmp(option, "number") == 0 || strcmp(option, "Number") == 0) { cout << "Enter in any number between " << SHRT_MIN << " and " << SHRT_MAX << endl; cin >> number; pass(number); delete [] string; } else if(strcmp(option, "string") == 0 || strcmp(option, "String") == 0) { cout << "Enter in any text no more than " << ssz-1 << " characters long\n"; cin.getline(string, ssz); pass(string); delete [] string; } else { cout << "You need to type in either \"number\" or \"string\" try again,\nPress Enter to continue.\n"; cin.get(); goto restart; delete [] string; } cin.get(); } void pass(short num) { using std::cout; using std::endl; cout << "The number you entered was " << num << " and " << num << " multiplied by 2 = " << num*2 << endl; } void pass(char* str) { using std::cout; cout << "the text you entered was " << str << ",\n" << "which contains exactly " << strlen(str) << " characters" << " in it.\n"; }
-
Answer:
Hi,Sean There are 3 step to repair runtime error If you got runtime error then there is a 94% chance that your computer has registry problems. To repair runtime error you need to follow the steps below: * Step 1 - Download a runtime error repair tool,install this error repair tool. * Step 2 - Click the Repair All Button.It will scan you pc for Free. * Step 3 - Then click the Repair All Button again and your done! It is very easy to repair runtime error. Here are the url of runtime error repair tool:http://www.fixerrorfast.com/ttfix-runtime_error-zz0001
Sean at Yahoo! Answers Visit the source
Related Q & A:
- When trying to open attachments, it doesn't open, but says "scanning for viruses".?Best solution by Yahoo! Answers
- Can some plz help, i want to get an 11-15 oyster photo card and i dont know how to post it?Best solution by Yahoo! Answers
- Yahoo Messenger Not Working...Plz Help Me?
- How do I fix this Runtime error?Best solution by eHow old
- What is the incoming and outgoing server information for Yahoo account when trying to set up Microsoft outlook?Best solution by emailaddressmanager.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.