Well I'm trying to learn C++ (know a little Python) and I wrote what was supposed to be a quick and easy four function calculator. Well, after finally getting the compiler to work without any errors or warnings, the program wouldn't open up or do anything. It was running, though, and I had to close it via the processes tab, because I couldn't see it.
Anyone got any ideas on this one?
EDIT:
Oh, and I'm using wxDev-C++ if that makes any difference.
EDITEDIT:
Ah, reading another thread led me to a site that mentioned the answer. I chose 'blank application' when I should have chosen 'console application'.
This leads me to another problem, though, and it will probably help me along the road to find the answer now. I went into the properties dialog for the project and changed the compiler to 'console application', where it was (if I'm not mistaken, I could be doing it wrong) on GUI application. That didn't do anything, though. I had to start a new project and copy/paste the code.
EDITEDITEDIT(he h):
Also, this behavior seems to be inconsistent. I've chose 'blank application' with another example with no problem.
Anyone got any ideas on this one?
EDIT:
Oh, and I'm using wxDev-C++ if that makes any difference.
EDITEDIT:
Ah, reading another thread led me to a site that mentioned the answer. I chose 'blank application' when I should have chosen 'console application'.
This leads me to another problem, though, and it will probably help me along the road to find the answer now. I went into the properties dialog for the project and changed the compiler to 'console application', where it was (if I'm not mistaken, I could be doing it wrong) on GUI application. That didn't do anything, though. I had to start a new project and copy/paste the code.
EDITEDITEDIT(he h):
Also, this behavior seems to be inconsistent. I've chose 'blank application' with another example with no problem.
Code:
#include <iostream> using namespace std; float FourFunc(float Num1, float Num2, int Choice) { float Answer = 0; switch(Choice) { case 1: Answer = Num1 + Num2; break; case 2: Answer = Num1 - Num2; break; case 3: Answer = Num1 * Num2; break; case 4: Answer = Num1 / Num2; break; } return Answer; } int main() { cout<<"-----------------FourFunc Calc-----------------------\n"; int Choice; float Num1, Num2; bool On = 1; while (On == 1) { cout<<"Please choose one of the following options: \n"; cout<<" 1:Addition\n 2:Subtraction\n 3:Multiplication\n 4:Division\n 5:Quit\n"; cin>>Choice; if (Choice != 5) { if ((Choice > 0) && (Choice < 6)) { cout<<"Enter number: "; cin>>Num1; cout<<"\nEnter number: "; cin>>Num2; cout<<"\nThe answer is: "<< FourFunc(Num1, Num2, Choice); } else { cout<<"\nThere seems to have been an Input Error. You might try again."; } } else { On = 0; } } return 0; }
Comment