Awkwardsaw
2010-03-07 17:20:34
#include <iostream>
using namespace std;
struct num {
int num1;
int num2;
} number;
void getnums(void)
{
cout << "First Number: ";
cin >> number.num1;
cout <<"Second Number: ";
cin >> number.num2;
}
int addition (void)
{
return (number.num1 + number.num2);
}
int subtraction (void)
{
return (number.num1 - number.num2);
}
int multi (void)
{
return (number.num1 * number.num2);
}
int divide (void)
{
return (number.num1 / number.num2);
}
int square (void)
{
return (number.num1 * number.num1);
}
int main()
{
string x;
loop:
cout << "instructions - type: " << endl;
cout << "+ to add" << "- to subtract" << endl << "* to multiply" << endl;
cout << "/ to divide" << endl << "^2 to square" << endl;
cin >> x;
getnums();
switch (x) {
case '+':
cout << addition();
break;
case '-':
cout << subtraction();
break;
case '*':
cout << multi();
break;
case '/':
cout << divide();
break;
case '^2':
cout << square();
break;
default:
cout << "wrong input!";
goto loop;
}
system("PAUSE");
return EXIT_SUCCESS;
}
if something is not right, tell me how to fix it pl0x :) i did a lot of the things as best as i can think of, and to learn/ try different stuff
i cannot compile this my self for some reason, i keep getting a "all-before does not exist - don't know how to make it" error
also, i would like more ideas on what to make, i am stumpt :(