i'm developing a c++ program here and also i'm nwe to c++.
i have been given a program that has to print integers from 0-10 with their squares and cubes in a table form. but the problem is i'm only allowed to use if statement onyl to do this program.well this is how i did it.
#include<iostream>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
int main()
{
int a;int b;int c;int d;int e;int f;int g;int h;int i;int j;int k;
int square;
int cube;
cout<<"enter any number"<<endl;
cin>>a;
square=a*a;
cube=a*a*a;
cout<<a<<"\t"<<square<<"\t"<<cube<<endl;
cin>>b;
square=b*b;
cube= b*b*b;
cout<<b<<"\t"<<square<<"\t "<<cube<<endl;
return 0;
}
i repeated the statement until i used all the variables above.
it appears like this
integer square cube
0 0 0
1
1 1 1
2
2 2 2
my problem is how to remove this numbers between because it has to appear like this
integer square cube
0 0 0
1 1 1
2 2 2