Desperately need your comments - C++ language

Well, hi everybody, I have some problems with one task (C++) which I can not solve. It is quite immidiate, so can anyone solve this for me?

Task is:

Make program in C++, which will write n int numbers and calculate function:
f(n)=2n3-4n+5.
Program should cout on monitor thing exactly like this (said my professor):

n=1 f(n)=3
n=2 f(n)=13
n=3 f(n)=47
etc.

Note: n number which is entered from keyboard should be smaller than 20, and bigger than 1. If you enter for example 21, program should not write anything. And yes, I must use FOR command.

I am waiting, I have two hours to give this to professor!!!
can anyone solve this for me?
No. http://www.cplusplus.com/articles/how_to_ask/

Post what you have so far and the specific problem you have that prevents you from getting to the solution
i'll give u a hint..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>
using namespace std;

int square(int a)
{
	return a*a;
}

int main()
{
	int ax;
	cin >> ax;
	cin.sync();cin.clear();
	for(int i=1;i<=ax;i++)
	cout << square(i) << endl;
	cin.ignore();
	return 0;
}
Topic archived. No new replies allowed.