0

Guys am new in the field of c++ programming since I finished my college I decided to start programming
but their is a step I have reached and am stalk I have made my simple program amd I wanted to put it
in GU. Am using Linux Ubuntu and I would like to put my program in GU am tired of nicked programs
How can I get GU and how can I install it in linux ubuntu
Here is my program which I want to put in GU and you can tell me how is supposed to be

// SIMPLE CALUCULATION IN C++ PROGRAMMING
#include <iostream>
#include <cstdlib>
#include <cmath>

using namespace std;
int main ()
{
      while (true) {
        signed long int num1, num2;
        signed long int ans;
        cout << "S7 CALCULATOR" <<endl;
        cout << "----------------";
        cout <<endl; 
        cout << "1.Add."<<endl;
        cout << "2.Substraction."<<endl;
        cout << "3.Multiplication."<<endl;
        cout << "4.Division."<<endl;
        cout << "5.Exist program."<<endl;
        cout << endl;

        cout << "\tChose your option(1-5):";
        cin >> ans;


      if (ans == 1)
         {
           cout << "(Addition)"<<endl;
           cout << endl;
           cout << "Enter the first num:";
           cin>> num1;
           cout << "Enter the second num:";
           cin >> num2;
           cout << endl;
           cout << "The answer is:" << num1 + num2;
           cout <<endl;
           }


            if (ans == 2)
            {
             cout << "(Substraction)"<<endl;
             cout << endl;
             cout << "Enter the first num:";
             cin >> num1;
             cout << "Enter the second num:";
             cin >> num2;
             cout << "The answer is:" << num1 - num2;
             cout <<endl;
             }

             if (ans == 3)
              {
                cout << "(Multiplication)"<<endl;
                cout << endl;
                cout << "Enter the first num:";
                cin >> num1;
                cout << "Enter the second num:";
                cin >> num2;
                cout <<endl;
                cout << "The answer is:" << num1 * num2;
                cout <<endl;
               }

               if (ans == 4)
              {
                 cout << "(Division)"<<endl;
                 cout << endl;
                 cout << "Enter the first num:";
                 cin >> num1;
                 cout << "Enter the second num:";
                 cin >> num2;
                 cout << endl;
                 cout << "The answer is:" << num1 / num2;
                 cout <<endl;
               }

                        if (ans == 5)
                        {
                          cout <<"\tExit program";
                          cout << "\tThank you:\n";
                          exit (1);
                          }
                          }

                          return 0;
                          }
2
Contributors
1
Reply
7
Views
5 Years
Discussion Span
Last Post by petzoldt01
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.