Wednesday, January 1, 2020

Square Values Using Functions in C++

I wrote this program almost 10 years ago that will ask the user to give a series of values and then the program will compute the square values of the given series of numbers using functions in C++ programming language. Happy New year to all my followers and visitors to my website. Thank you for all the support.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/

https://www.unlimitedbooksph.com/

Program Listing

square.cpp

#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