cant figure out how to struture this

Nov 15, 2015 at 12:19am
2) Write a program that will allow you to enter 4 separate numbers. The code should be able to do the following:
a. Add the first 2 numbers
b. Subtract the third and fourth number
c. Multiply the first and third number
d. Divide the second and fourth number (and show the remainder if any exist)


can anyone help wit this ...idk how to do this

Nov 15, 2015 at 1:23am
I suggest you start studying.

This is not a homework site. We're not going to write it for you.
Nov 17, 2015 at 9:16pm
this is what i did.... the only problem is idk how to get it to accept 4 numbers alone ....the program i wrote requires 8 numbers to be entered



#include <stdlib.h>
#include <iostream>
using namespace std;
int main()
{
float a, b, c, d, e, f, g, h;
cout << "Enter four numbers \n";
cin >> a >> b;
e= a + b;
cout <<"Sum of a + b = " << e << " \n";
cin >> c >> d;
f= c - d;
cout <<"Subtraction of c - d = " << f << " \n";
cin >> a >> c;
g = a * c;
cout << "Muldtplaction of a * c = " << g<<" \n";
cin >> b >> d;
h = b / d;
cout << "Division of b / d = " << h<<" \n";
system("pause");
return 0;
}
Nov 17, 2015 at 9:48pm
Hey. Please use code tags for your code - http://www.cplusplus.com/articles/jEywvCM9/

It looks pretty good until you get to this part

1
2
3
4
5
6
cin >> a >> c;
g = a * c;
cout << "Muldtplaction of a * c = " << g<<" \n";
cin >> b >> d;
h = b / d;
cout << "Division of b / d = " << h<<" \n";


Why are you re-entering the values for c,a,b and d? You already have these values from previously.

What I would recommend doing. Is first Inputting all 4 values. And then just doing the math with them, no more input after that.
Nov 17, 2015 at 11:25pm
thanks ...well that's the part i need help with.
i dont know how to input the 4 values at first..... do u have any example i can follow
Topic archived. No new replies allowed.