Source Codes for Calculator in C++ Using Arrays?

Source Codes for Calculator in C++ Using Arrays?
Last edited on
What is your definition of "graphical calculator"?
What should the arrays be used for?
have a Beautiful view, Of course, this does not matter
Important point is that the arrays are used, I do not know the exact What should the arrays be used for?.
Only the project is written that : using the arrays
Last edited on
1
2
3
4
5
6
cout << "Graphical calculator\n";
cout << "This is a char array\n\nAnd this is the graphic: :^)\n\n\n";
cout << "Enter a number: " << flush;
int i = 0;
cin >> i;
cout << "The number after the one you entered is " << i+1 << "\n\nThanks" << endl; 
Is this enough?
a complete calculator i said !
"complete" is subjective in this case
I call Wolfram Mathematica a complete calculator.
Last edited on
k xerxes we are all in this programing world together now if you want better help you need to do what we all have done spend a few days doing basic programing because you cant learn this whole program over night for some it will take months and others years but we can all help eachother easyly now im not being rude well maybe a little but listen to me on this i can help you on starting your calculator but its gonna be consol based and you are gonna have to program a bit your self ok i will submit a code shortly
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
#include <iostream> // this tells you that you can have in and output
using namespace std; // this is always required or system::std;

int main () // this is saying that you are intinalzing a main directory
{ //this opens your dir
	while (true){
		system("cls");
		cin.clear();

		int num;
		cout << "to add press 1, to sub press 2, to times press 3, to divide press 4: ";// cout is saying that you are having the program ask you a question and your options.
		cin >> num; // this says that your keypress = num
		switch(num) { // this allows the user to have options
			case 1: // this is your first option
				int x0;
				int y0;
				cout << "Adding\n"; // "\n" will auto type on the screen your text and then hit the enter key
				cout << "enter your first number: ";
				cin >> x0;
				cout << "enter your second number: ";
				cin >> y0;
				cout << "your answer is ";
				cout << x0 + y0;
				break;
			case 2:
				int x1;
				int y1;
				cout << "Subtracting\n";
				cout << "1st #: ";
				cin >> x1;
				cout << "2nd #: ";
				cin >> y1;
				cout << x1 - y1;
				break;
			case 3:
				int x2;
				int y2;
				cout << "Multiplying\n";
				cout << "1st #: ";
				cin >> x2;
				cout << "2nd #: ";
				cin >> y2;
				cout << x2 * y2;
				break;
			case 4:
				break;
		}
		system ("pause");
	}return 0;
}


ok dude heres your start now you have to finish it look in the forums to find out how to add the division option i hope that this helps but i do know that its hard to build graphics into a c++ program so if you are looking for graphics you will need a different program atleast thats of my knowledge
@xerxes: The really good calculators use stacks, not arrays. However...
@Bazzy: Good point.
@xerxes: Beautiful view? What?
@Bazzy: Win.
@xerxes: Fail.
@R0mai: Win.
@MSkillet: Neither win nor fail.
@MSkillet: There are easier and shorter and more beautiful ways to do that.

For your graphical interfaces, might you consider GTK+? If you're not running Mac or any *nix operating system and are running Windows instead, expect that task to be much harder.

-Albatross


Last edited on
Topic archived. No new replies allowed.