#include <iostream>
#include <string>
using namespace std;
int Calculator(int x,int y){
int answera = x + y;
int answerb = x - y;
int answerc = x * y;
int answerd = x / y;
int answere = x % y;
cout << x << " + " << y << " equals..." << answera << endl;
cout << x << " - " << y << " equals..." << answerb << endl;
cout << x << " * " << y << " equals..." << answerc << endl;
cout << x << " / " << y << " equals..." << answerd << endl;
cout << x << " % " << y << " equals..." << answere << endl;
int main()
{
for(0<=0){
int x;
int y;
cout << "input 1 number" << endl;
cin >> x;
cout << "input 1 more number" << endl;
cin >> y;
cout << "now watch this baby..." << endl;
Calculator(x,y);
}
system("PAUSE");
return 0;
}
im using the loop but i get a error whats the proper way to put this program to repeat the commands within mains bracets to repeat over and over.
1. you have to close Calculator function . Put "}" sign before "int main()"
2. I don't think for loop can be used like that "for(0<=0)".
Instead of "for(0<=0)" , put "for(;0<=0;)"
There are 2 things wrong here:
1. There is no indentation. Look at example code, and use it as an example for indentation.
2. You are using the "for" loop incorrectly. Look at the documentation for it.
1. main() is declared within another function. Not allowed. Functions should have prototypes. While not a strict requirement, it's good practice to provide one.
2. The declaration of the for loop is incorrect syntactically. The declaration should reflect this: for(declaration; proposition; increment/decrement). You can omit all three if you wish, but that will create an infinite loop. If you omit a field, be sure to use the semi-colon, like so: for( ; var < 10; ++var).