I just got back into C++ and it seems like so much has changed since i last messed with it at all, like the #include<header.h>, what happened????
Anyway, like I said i just got back into programming a little bit, I figure its better than wasting my time watching TV, so i started doing little tutorials and then making my own stuff just so I can see if I know what im doing
Code:#include<iostream> using namespace std; void whatsthatnumber(int* simple, int* simple2); int main(void) { int num1; int num2; int result; int answer; cout << "Do you want to run the small program? Press 1 for YES, anything else for NO" << endl; cin >> answer; if (answer == 1) { answer = ; whatsthatnumber(&num1, &num2); } else { cout <<"Thanks anyway"<<endl; system("PAUSE"); return 0; } whatsthatnumber(&num1, &num2); result = (num1 + num2); cout << endl; cout << result; system("PAUSE"); return 0; } // int* is to pass variables to other functions, like piPointer1, can not be used in main() unless you do int* which sets the number to your memory instead of just in the function itself void whatsthatnumber(int* simple, int*simple2) { cout << "input the first number: " << endl; cin >> *simple; cout <<"Input the second number: "<<endl; cin >> *simple2; cout<<"Thanks..calculating.."<<endl; cout<<"."<<endl; cout<<".."<<endl; cout<<"..."<<endl; }
thats what I wrote...
If I hit 1, which brings me to the whatsthatnumber() function, ill get to input the two numbers, and thats fine, but after I hit enter after the second number, it makes me input the numbers again for some reason, can anyone tell me what im doing wrong?



LinkBack URL
About LinkBacks



