I'm using:
Windows + Cygwin (GCC Compiler)
So my source goes like this
(I didn't write notes yet... so bear with me...)
CODE
#include <iostream>
using std::cout;
using std::cin;
int x;
int y;
int z;
char tpyeOfAction;
char toContinue;
char yes;
int process1(x)
{
cout << "Enter number to add to " << x << ".";
cin >> y;
z = (x+y);
return z;
}
int process2(x)
{
cout << "Enter the number to subtract from " << x << ".";
cin >> y;
z = (x-y);
return z;
}
int process3(x)
{
cout << "Enter the number to multiply " << x << " by.";
cin >> y;
z = (x*y);
return z;
}
int process4(x)
{
cout << "Enter the number to divide " << x << " by.";
cin >> y;
z = (x/y);
return z;
}
int process5(x)
{
cout << "Are you sure you want to square " << x << "?";
cin >> yes;
if (yes ="yes")
{
z = (x*x);
return z;
}
if (yes ="y")
{
z = (x*x);
return z;
}
else
{
return 0;
}
}
int main()
{
cout << "Welcome to calculator, when you'd like to begin, simply enter a number, and press enter (or return).";
cin >> x;
cout << "Now, to Add type: 'ADD' or +\nTo Subtract, type: 'MINUS' or -\nTo Multiply tpye: 'MULTIPLY' or * \nTo Divide type: 'DIVIDE' or /\nTo square, type: @ (SHIFT + #2).";
cin >> typeOfAction;
if (tpyeOfAction= "ADD" or "+")
{
process1(x);
}
if (typeOfAction= "MINUS" or "-")
{
process2(x);
}
if (typeOfAction= "MULTIPLY" or "*")
{
process3(x);
}
if (typeOfAction = "DIVIDE" or "/")
{
process4(x);
}
if (typeOfAction = "@")
{
process5(x);
}
else
{
return 0;
}
return 0;
}
The point of this is to:
Ask for initial number, 'x'
Ask for process to use on number (for example: "ADD")
Ask for second number to affect first 'y'
Return Answer.
SO.
I tell it to compile the source,
and it comes up with a list of errors
"11: error: ecpected ',' or ';' before '{' token
18: error: ecpected ',' or ';' before '{' token
25: error: ecpected ',' or ';' before '{' token
32: error: ecpected ',' or ';' before '{' token
39: error: ecpected ',' or ';' before '{' token"
This is... weird, to say the least.
I made 'Hello world!' Program and this didn't happen...
Anyway
There are more weird errors.
"64: error 'process1' cannot be used as a function
68: error 'process2' cannot be used as a function
72: error 'process3' cannot be used as a function
76: error 'process4' cannot be used as a function
80: error 'process5' cannot be used as a function"
I included a picture,
a couple errors have been resolved since.
Again this is weird.
Well, I'm new to C++ so I don't have a clue at to where to go with this...
Anyway, thank you.
And btw, if you see any bugs in my source please tell me.