heelp with homework

closed account (SEbXoG1T)
/* not copyrighted in any way shape or form.
made purely for the joy of calculating.

-jg16477 */


#include <math.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
double a, b, param, result;
char answer;
std::string input, input2, input3, input4;
do {
cout<<"login: ";
cin>>input3;
} while (input3 != "jg16477") ;
do {
cout<<"password: ";
cin>>input4;
} while (input4 != "dragon2") ;
cout<<"hello mr. grass!! \n\n";
cin.get();

do
{
cout<<"what operation do you wish to do Mr. Grass ? [+-*/ (if you wish to do squre root enter 1) ] ";
cin>>answer;
switch (answer) {
case '*':
cout<<"multiplication";
cin>>a;
cout<<"* ";
cin>>b;
cout<<a*b;
cin.get();
cin.get();
break;
case '1':
cout<<"sqrt(";
cin>>param;
result = sqrt (param);
printf ("sqrt(%lf) = %lf\n", param, result );
break;
case '/':
cout<<"division";
cin>>a;
cout<<"/ ";
cin>>b;
cout<<a/b;
cin.get();
cin.get();
break;
case '+':
cout<<"addition";
cin>>a;
cout<<"+ ";
cin>>b;
cout<<a+b;
cin.get();
cin.get();
break;
case '-':
cout<<"subtraction";
cin>>a;
cout<<"- ";
cin>>b;
cout<<a-b;
cin.get();
cin.get();
break;
default:
do {
cout<<"please input an answer\n";
cout<<"what operation do you wish to do? [+-*/] ";
cin>>answer;
switch (answer) {
case '*':
cout<<"multiplication ";
cin>>a;
cout<<"* ";
cin>>b;
cout<<a*b;
cin.get();
cin.get();
break;
case '/':
cout<<"division ";
cin>>a;
cout<<"/ ";
cin>>b;
cout<<a/b;
cin.get();
cin.get();
break;
case '+':
cout<<"addition ";
cin>>a;
cout<<"+ ";
cin>>b;
cout<<a+b;
cin.get();
cin.get();
break;
case '-':
cout<<"subtraction ";
cin>>a;
cout<<"- ";
cin>>b;
cout<<a-b;
cin.get();
cin.get();
break;
}} while (((input2 != "*") || (input2 != "-") || (input2 != "+") || (input2 != "/") ));


}
cout<<"do you wish to go again? [Y/N] ";
cin >> input;
} while ((input == "Y") || (input == "y"));
return 0;

}
I am trying to incorporate prime factorization into this
closed account (S6k9GNh0)
1. Format your code and use code tags. Make it look nice and readable. Use adequate spacing and the such.
2. Please be aware we do not give answers. You will get hints.
closed account (SEbXoG1T)
not homework, just have to get peoples attention
What? So, um, what's the point of this deception, then?

EDIT: Oh, wait a sec. This is supposed to be a full solution to a homework problem that asks for a calculator. If I'm right... take it down, please. There's a reason we don't give answers here.

-Albatross
Last edited on
closed account (SEbXoG1T)
I'm not even in high school, i am just trying to get help
Oh.... 'kay then....
http://cplusplus.com/articles/how_to_ask/

-Albatross
Topic archived. No new replies allowed.