🔒 Closed Baka po may kayang gumawa neto or meron po kayong source code na dito sa C++. Btw DEV C++ po pala ang gamit namin.

Status
Not open for further replies.

aewrin

Established
1649114252152.webp
 
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

int main()
{
float x, y;
int option;
float result;
string selection;
cout << "This program will add multiply and divide two numbers"<<endl<<endl;
cout << "Please enter two numbers separated by space:"<<endl;
cin >> x >> y;

cout << "Enter a select code"<<endl;
cout << "\t (1) for addition" << endl;
cout << "\t (2) for multiplication" << endl;
cout << "\t (3) for division" << endl;
cin >> option;

switch (option)
{
case 1: selection = "added to";
result = x + y;
break;
case 2: selection = "multipled by";
result = x*y;
break;
case 3: selection = "divided by";
result = x / y;
break;
}

cout << "The first number " << selection << " the second number is " << result << endl;


getchar();
getchar();
return 0;
}

You can use this as a guide.
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 670
    Views
  • 3
    Participants
Last reply from:
Aoshinomori

Trending Topics

Online now

Members online
1,033
Guests online
1,227
Total visitors
2,260

Forum statistics

Threads
2,274,059
Posts
28,953,407
Members
1,235,039
Latest member
Drifter007
Back
Top