Math Solver problems.

Pages: 12
ok i will try that out thanks
WOW Albatross your a god at this all my errors are finished but i got two warnings about int no1, po1;
A god? Hmm... are birds gods? I dunno... do we have any philosophical programmers in this forum?!?

The warnings... what are they? I usually ignore warnings if I know exactly what I'm doing, but they're useful for telling me that I might not know what I'm doing. I expect it might be similar with you...

-Albatross

P.S.- Thanks.
Well i guess we can finish this off with that my main problems are solved in this math solver and to be nice i will provide the code for you guys if you want to use or alter anything and add whatever you want but please tell me what you are adding so i to can add the same to my code that way i know what others want in this code so heres my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* Math Solver with switch cases */
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main(){
	while (true) {//This repeats the program. You close window manually by clicking "x".
		system("CLS");
		cin.clear(); // this will clear any values remain in cin from prior run
		int num;
		cout << ">>>>>>>>>>>>>>>>>>>Welcome to Math Solver<<<<<<<<<<<<<<<<<<<\n";
		cout << "For Formulas press 1.\n";
		cout << "For Advanced Numbers press 2.\n";
		cin >> num;
		switch(num) {
			case 1:
				cout << "For Area press 1.\n";
				cout << "For Volume press 2.\n";
				cout << "For Circumfrence press 3.\n";
				cin >> num;
				switch(num) {
					case 1:
						cout << "Area.\n\n";
						int l, w; // this is the length, and width
						cout << "Enter The Length: ";
						cin >> l;
						cout << "Enter the Width: ";
						cin >> w;
						cout << "The area is ";
						cout << l * w; 
						cout << "\n\n";
						break;
					case 2:
						cout << "Volume.\n\n";
						int l1, w1, h1; // this is the length, width, and height
						cout << "Enter the Length: ";
						cin >> l1;
						cout << "Enter the Width: ";
						cin >> w1;
						cout << "Enter the Height: ";
						cin >> h1;
						cout << "The Volume is ";
						cout << l1 * w1 * h1;
						cout << "\n\n";
						break;
					case 3:
						cout << "Circumfrence.\n\n"; // ((2(r))pi) or C=2 * pi * R
						int c;
						cout << "Enter the radius: ";
						cin >> c;
						cout << "the circumfrence is ";
						cout << 2 * c * 3.14159;
						cout << "\n\n";
						break;
					}
				break;
				cout << "\n\n";
				case 2:
					cout << "For Square Root's press 1, For Powers press 2";
					cin >> num;
					switch(num) {
					case 1:
					cout << "Square Roots: "; // Can not access this anymore
					int n00;
					cout << "Enter the number that you want to know the Square Root of: ";
					cin >> n00;
					{
						double param, result;
						param = n00;
						result = sqrt (param);
						printf ("The square root of (%lf) is %lf\n", param, result );
					}
					cout << "\n\n";
					break;
				case 2:
					cout << "Powers: "; // in progress and need a lot of help in this
					int n01, p01;
					double no1, po1, result; // these must be double or float
					no1 = po1 = result = 0; // intializing
					std::cout << "Please enter the Base: ";
					std::cin >> no1;
					std::cout << "Please enter Exponntial: ";
					std::cin >> po1;
					result = pow(no1, po1);
					std::cout << no1 << "^" << po1 << " = " << result << '\n';
					break;
					}
		}
		system ("PAUSE");
	}//this ends while loop
	return 0;
}// this ends your main function. 


{note to the admin(s)} is it allright if this forum doesn't get deleted (if they are unactive for a long time) that way i don't have to retype my code when i go to change it arround thanks.


also thanks to everyone that has helped in the success of this code and even though this is solved how do you input a divide command so the user can plug in there own numbers i have already tryed
1
2
3
4
5
6
7
8
{
int no2, no3;
cout << "1st #: \n";
cin >> no2;
cout << "2nd #: \n";
cin >> no3;
cout << "this = " no2/no3;
}


or something like that lol thanks again and happy coding
nevermind i fixed the code somehow but thanks to albatross for teaching me how to shorten up my code it was very useful also thanks to everyone else for helping me in making this code prefect (in my eyes) thanks again

Skillet

also i will post my final code tomorrow after i fix my spelling and make it look a little more nicer

night guys thanks again and happy coding

ohh albatross i got my errors fixed i forgot to delete the lines that had the code
 
int no1, po1


after i deleated those this is now working nicely without any errors thanks so much buddy
P.S. Birds are gods
Last edited on
Ok guys like i promised heres my code that is fully up to date:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* Math Solver with switch cases */
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main(){
	while (true) {//This repeats the program. You close window manually by clicking "x".
		system("CLS");
		cin.clear(); // this will clear any values remain in cin from prior run
		int num;
		cout<<">>>>>>>>>>>>>>>>>>>Welcome to Math Solver<<<<<<<<<<<<<<<<<<<\nFor Formulas press 1.\nFor Advanced Numbers press 2.\nFor Basic Math press 3.\n";
		cin>>num;
		switch(num){
			case 1:
				cout<<"For Area press 1.\nFor Volume press 2.\nFor Circumfrence press 3.(Circles)\n";
				cin>>num;
				switch(num){
					case 1:
						cout<<"Area.\n\n";
						int l, w; // this is the length, and width
						cout<<"Enter The Length: ";
						cin>>l;
						cout<<"Enter the Width: ";
						cin>>w;
						cout<<"The area is ";
						cout<<l * w; 
						cout<<"\n\n";
						break;
					case 2:
						cout<<"Volume.\n\n";
						int l1, w1, h1; // this is the length, width, and height
						cout<<"Enter the Length: ";
						cin>>l1;
						cout<<"Enter the Width: ";
						cin>>w1;
						cout<<"Enter the Height: ";
						cin>>h1;
						cout<<"The Volume is ";
						cout<<l1 * w1 * h1;
						cout<<"\n\n";
						break;
					case 3:
						cout<<"Circumfrence.\n\n"; // ((2(r))pi) or C=2 * pi * R
						int c;
						cout<<"Enter the radius: ";
						cin>>c;
						cout<<"the circumfrence is ";
						cout<<2*c*3.14159;
						cout<<"\n\n";
						break;
					}
				break;
				cout<<"\n\n";
				case 2:
					cout<<"For Square Root's press 1\nFor Powers press 2\n";
					cin>>num;
					switch(num) {
					case 1:
					cout<<"Square Roots: "; // Can not access this anymore
					int n00;
					cout<<"Enter the number that you want to know the Square Root of: ";
					cin>>n00;
					{
						double param, result;
						param=n00;
						result=sqrt (param);
						printf("The square root of (%lf) is %lf\n", param, result );
					}
					cout<<"\n\n";
					break;
				case 2:
					cout<<"Powers: ";// in progress and need a lot of help in this
					double n01, n02, result; // these must be double or float
					n01=n02=result=0; // intializing
					std::cout<<"Please enter the Base: ";
					std::cin>>n01;
					std::cout<<"Please enter Exponntial: ";
					std::cin>>n02;
					result=pow(n01, n02);
					std::cout<<n01<<"^"<<n02<<" = "<<result<<'\n';
					break;				
					}
					break;
				case 3:
					cout<<"Back to the basics.\nFor Adding Press 1.\nFor Subtracting Press 2.\nFor Multiplication Press 3.\nFor Division Press 4.\n";
					cin>>num;
					switch(num) {
				case 1:
					int n03, n04;
					cout<<"Adding\nEnter your First number: ";
					cin>>n03;
					cout<<"Enter your second number:";
					cin>>n04;
					cout<<n03<<" + "<<n04<<" = "<<n03+n04<<"\n";
					break;
				case 2:
					int n05, n06;
					cout<<"Subtracting\nEnter your First Number: ";
					cin>>n05;
					cout<<"Enter your Second Number: ";
					cin>>n06;
					cout<<n05<<" - "<<n06<<" = "<<n05 - n06<<"\n";
					break;
				case 3:
					int n07, n08;
					cout<<"Multiplying\nEnter your First Number: ";
					cin>>n07;
					cout<<"Enter your Second Number: ";
					cin>>n08;
					cout<<n07<<" X "<<n08<<" = "<<n07*n08<<'\n';
					break;
				case 4:
					int n09, n10;
					cout<<"Dividing\nEnter your First Number: ";
					cin>>n09;
					cout<<"Enter your Second Number: ";
					cin>>n10;
					cout<<n09<<" / "<<n10<<" = "<<n09/n10<<"\n";
					break;
						break;
					}
		
		}
		system("PAUSE");
	}//this ends while loop
	return 0;
}// this ends your main function. 


you guys can use it as you wish have fun
Topic archived. No new replies allowed.
Pages: 12