|
From: Kirktoun .....T. C. F. <kir...@bt...> - 2002-03-31 16:34:55
|
Hi there,
Here is a program to input 5 floats and output them to the screen, using =
loops. oh i am using the bloodshed compiler.
#include <iostream>
#include <iomanip>
#include <conio.h>
using std::cout;
using std::cin;
using std::endl;
#define MAX 5
int main()
{
float number[MAX];
int x;
cout << " A program to enter and display 5 floating point numbers " << =
endl << endl;
for (x=3D0;x<MAX; x++)
{
cout << " Enter number:" << x+1 << endl;
cin >> number[x];
}
cout <<"Press any key to show your numbers" << endl << endl << endl;
getche();
x=3D0;
for (x=3D0;x<MAX;x++)
{
cout <<"float number:"<< x+1 <<" is";
cout.width(10);
cout << setprecision(2) << setiosflags(ios::fixed | =
ios::showpoint);
cout << number[x];
cout << endl << endl << endl;
}
cout <<"Press any key to Exit The Program" << endl;
getche();
return(0);
}
|