Mega Code Archive

 
Categories / C++ Tutorial / Data Types
 

Lists cubes from 1 to 10

#include <iostream>    #include <iomanip>                       using namespace std;       int main(){       int numb;                                   for(numb=1; numb<=10; numb++){          cout << setw(4) << numb;          //display 1st column          int cube = numb*numb*numb;        //calculate cube          cout << setw(6) << cube << endl;  //display 2nd column       }    return 0;    }