/********************************************************************************************
onefile.cpp
Jim Millard
for CO311
simple program in one file
********************************************************************************************/
#include <iostream>
#include <string>
using namespace std;
//prototypes
void SayHello();
void SayPrompt(string);
float squared(const float);
//the MAIN main, which must be here -------------
void main()
{
SayHello();
string prompt = "Enter a number: ";
SayPrompt(prompt);
float input;
cin >> input;
cout << input << " squared equals " << squared(input) << endl;
return;
}
// --------- functions that can later exist elsewhere ---------
void SayHello()
{
cout << "This program will display the square of a number you input." << endl;
}
void SayPrompt(string prompt)
{
cout << prompt;
}
float squared(const float number)
{
return number * number;
}