#include<iostream.h>
#include<math.h>

void main()

{

float x,y;
cout<<"Please enter one number ";
cin>>x;
y=x*x;
cout<<"The square of the number you enter is "<<y<<endl;

}

:eek: Pls help... thx u very much...

Use a loop.

#include <iostream>
  using std::cout;
  using std::cin;
  using std::endl;
  
  int main()
  {
     for ( ;/* your condition here*/; )
     {
  	  float x,y;
  	  cout << "Please enter one number ";
  	  cin  >> x;
  	  y = x * x;
  	  cout << "The square of the number you enter is " << y << endl;
     }
     return 0;
  }

hello everyone
try this

#include<iostream.h>
#include<math.h>


void main()


{


float x,y;


while(1)
{
cout<<"Please enter one number ";
cin>>x;
y=x*x;
cout<<"The square of the number you enter is "<<y<<endl;
if (x < 0)
{
break;
}
}
}

This loop goes on forever until the user inputs a negative number and then the loop is broken and the program ends unlike the for loop which has a fixed number of loops.

Yours Sincerely

Richard West

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.