Hello all im working on my first console program ( calculator )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <iostream>
using namespace std;
int main()
{
int iOne;
int iTow;
int iThree;
int iFour;
iOne = 1;
iTow = 2;
iThree = 3;
iFour = 4;
int iNumbers;
cout << "Mathematic Calculator" << endl;
cout << endl;
cout << "1. ( + )" << endl;
cout << "2. ( - )" << endl;
cout << "3. ( X )" << endl;
cout << "4. ( / )" << endl;
cout << endl << "Pick One Option :" << endl;
cin >> iNumbers;
if (iNumbers == iOne) {
cout << endl << "Write Tow Numbers :";
cin >> iNumbers;
cout << " + ";
cin >> iNumbers;
cout << " = ";
cout << iNumbers + iNumbers << endl;
} else {
cout << endl << "Write Another Number !" << endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
|
its not completed but i have questions like how make in the if statemant
that it will be so cin = 50 + 50 = 100
i cannot make it like this becuase every cin have auto endl;
so i get someting like this
i write 50 and in next line it write + i write number 50 and then it show down = 100
i want it in 1 line 50 + 50 = 100
and other question how make other operations like - is - / * is * and / is / ??
i tryed use - but - no work
i tryed 50 - 20 and my = was 0 :D it is becuase i have int ??? it no need be other data type ?
and my last question why it show me press any key to continue and my console exit ? i wanna make new operations with this code i make 1 operation or i make 1 Wrong Number ! and it show me press any key to contine and i press and console close how i can make that i can do more operations .... ?
and how i can put in my code an END tab example press E to end calculator ?
Thank,s for read it :) hope u will help me with my iusses. See ya ...