Cant find the error(s)!!!

The assignment is: Write a program in C++ that inputs a value into a variable n and outputs the cube (n*n*n). Make sure the user of your program knows when to enter the integer and knows the result is the cube of the integer n. After emailing my code to my professor his only response to my email was..."There were errors". I have ran my program and I don't understand where the error is! Is there something I'm missing?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 // A program that cubes your numbers!

#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{
    double n, nCubed;

	cout << "Please enter a number and press enter" << endl;
	cin >> n;

	nCubed = (n*n*n);

	cout << "Your number cubed is:" << nCubed << " " <<endl;
	
	system("PAUSE");
    return 0;
}
closed account (Dy7SLyTq)
well i would first make n and nCubed an int. i dont see any errors, but instead of another variable i would do cout<<"..."<< n*n*n <<"...". also why is there a space after ncubed? its useless. other than that, i dont see anything wrong with it. can you post the whole assignment?
"Write a program in C++ that inputs a value into a variable n and outputs the cube (n*n*n). Make sure the user of your program knows when to enter the integer and knows the result is the cube of the integer n."
^^That is actually the entire assignment...but perhaps its because I declared a "double" instead of "int"....I'll modify that and hopefully it would help resolve the issue and get rid of the useless space lol. Thank you so much for the feedback! Greatly appreciated!!
Topic archived. No new replies allowed.