Well another semester has started almost done with all java classes, and now C++ has started. I like it so far it is shorter and somewhat easier code. I have a homework assignment which I have started on, but with just starting C++ not sure where to go. Class meets tomorrow and assignment is due Thursday. A fairly simple enough homework, but I keeping getting stumped, several errors are coming up, and we are just started learning debugging. I am using Visual Studio 2005, its what we're using in class.
Assignment:
Allow a user to input 2 fractions and compute their sum.
such as first fraction: 1/2
second fracton: 2/5
Sum: 9/10
My code:
1. # include<iostream>
2. using namespace std;
3. /* This program will prompt the user for two fractions and then it will figure their sum in a fractional form.*/
4. int main ()
5. {
6. int a;
7. int b;
8. int c;
9. int d;
10. int fraction first = a/b;
11. int fraction second = c/d;
12. cout<< "Enter first fraction;"<<endl;
13. cin>> a/b;
14. cout<< "Enter second fraction;"<< endl;
15. cin>> c/d;
16. cout>> "Sum ="<< ((a*d)+(b*c))/(b*d)<<endl;