A simple program that I wrote in C++ that will square a number based on the number given by the user.
My mobile number here in the Philippines is 09173084360.
If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
#include <iostream>
#include <iomanip>
using namespace std;
// Global Variable
int values[6],a=0;
void accept_data(void);
void display_result(void);
void accept_data()
{
for (a=1; a<=5; a+=1) {
cout << "Enter Value No. "
<< a << " : ";
cin >> a[values];
}
}
void display_result()
{
cout << "\n\n";
cout << setw(5)
<< "VALUES"
<< setw(18)
<< "SQUARE VALUES";
cout << "\n\n";
for (a=1; a<=5; a+=1) {
cout <<"\n" << setw(3) << a[values]
<< setw(16)
<< a[values] * a[values];
}
cout << "\n\n";
system("pause");
}
main() {
cout << "\n\n";
cout << "\t\t Square A Value Version 1.0";
cout << "\n\n\n";
accept_data();
display_result();
}
No comments:
Post a Comment