Hello,
Here is the problem ive been working on:
write a while loop that displays each int from 1 to 5 together with its square and a cube. Display all three values for integer on a separate line.
My problem is that it does not really do what it is asked to do.
here is my code:
#include<cmath>
#include<iostream>
using namespace std;
int main()
{
int count;
int x;
float xsquared;
float xcubed;
cout << "enter the value for x: " << endl;
cin >> x;
count = 0;
while (count < 4)
{
xsquared = x * x;
xcubed = x * x * x;
cout << xsquared << xcubed <<endl;
count = count + 1;
}
system("pause");
return 0;
}
Thank you ahead of time