In my code:
#include <iostream> using namespace std; int main() { int T; cout <<"enter T:"<< endl; cin >>T; int a, b for (int i=0; i<T; i=i+1) { cout <<"enter a and b:"<< endl; cin >>a >>b; cout <<"a+b=" <<(a+b)<< endl; } return 0; } gives an error message:
Compilation error main.cpp: In function 'int main()': main.cpp:10:9: error: expected initializer before 'for' for (int i=0; i<T; i=i+1) ^ main.cpp:10:23: error: 'i' was not declared in this scope for (int i=0; i<T; i=i+1) ^
I understand he does not like that i not used anywhere. What to do?