1-2 output the sum of squares and cubes of N numbers Time Limit: 1000 ms memory limit: 65536 K Description
You can use this exercise to master the input and output methods of C ++.
Use the VC ++ development environment to create a console application. Use the CIN and cout statements to allow the program to output the corresponding sum of squares and cubes based on the input integer.
Input
An integer
Output
Consists of two parts, the first part occupies a row, and the output Header "numbersquarecube"; note that each item occupies the width of a tab (use "\ t" to control, "\ t" at the end of each line). The second part outputs the values, squares, and cubes of All integers from 1 to the input integer, each item in each row also occupies the width of a tab;
If the number of inputs is 0 or negative, only the header is output.
Sample Input
5
Sample output
NumberSquareCube111248392741664525125
Prompt
Input
0
InputSample program from numbersquarecube
The main purpose of this question is not to solve this question, but to record the "\ t" tab used in this question!
# Include <iostream> using namespace STD; int main () {int N, I; CIN> N; cout <"numbersquarecube" <Endl; for (I = 1; I <= N; I ++) cout <I <"\ t" <I * I <"\ t" <I * I <"\ t" <Endl; // pay attention to the position where the tab "\ t" is used: Return 0 ;}
Sdut 1-2 outputs the sum of squares and cubes of N numbers (use of the tab "\ t)