what next?

hello, i have learned all the basics and some more advanced stuff...what do i do next...i know for some of you c++ is your job...do you make apps or games.....do u use win32??? -thx
Well, what would you like to do with C++? Knowing that might get you started. :)

-Albatross
well i would like to make a calculator using graphics....heres a program that sums up all i know pretty much exept pointers....the other thing i would like to know before graphics is how in a calculator program can i make it let the user use more than one operation in a math problem
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
128
129
130
131
132
133
134
135
136
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
    int Total = 0;
	int Amount;
	int Number;
	int whatoperation;
	int answertoaverage;
	int restart;

	while (restart) {
    system("CLS");

	cout << "Here are your choices(enter the number before the operation)" << endl << endl;
	cout << "1.Addition" << endl;
	cout << "2.Subtraction" << endl;
	cout << "3.Multiplication" << endl;
	cout << "4.Division" << endl;
	cout << "5.Average Calculator" << endl;

	cin >> whatoperation;

	system("CLS");

	switch(whatoperation){
    case 1:
    cout << "Enter in how many numbers you want to use" << endl;
	cin >> Amount;

	for(int i = 0; i < Amount; i++)   // Keeps looping until i == Amount
	{
		cout << "Number " << i << ": " ;  // Shows user what number they are entering
		cin >> Number;

		Total = Number + Total;  // Adds number to total
	}

	cout << "The total is " << Total << endl;  // Prints out total value when loop has finished
	break;

	case 2:
	cout << "Enter in how many numbers you want to use" << endl;
	cin >> Amount;

	for(int i = 0; i < Amount; i++)
	{
		cout << "Number " << i << ": " ;
		cin >> Number;

		if(i == 0)
		{
			Total = Total + Number;
		}

		else
		{
			Total = Total - Number;
		}
	}

	cout << "The total is " << Total << endl;
	break;

	case 3:
	cout << "Enter in how many numbers you want to use" << endl;
	cin >> Amount;

	for(int i = 0; i < Amount; i++)
	{
		cout << "Number " << i << ": " ;
		cin >> Number;

		if(i == 0)
		{
			Total = Total + Number;
		}

		else
		{
			Total = Total * Number;
		}
	}
	cout << "The total is " << Total << endl;
	break;

	case 4:
	cout << "Enter in how many numbers you want to use" << endl;
	cin >> Amount;

	for(int i = 0; i < Amount; i++)
	{
		cout << "Number " << i << ": " ;
		cin >> Number;

		if(i == 0)
		{
			Total = Total + Number;
		}

		else
		{
			Total = Total / Number;
		}
		cout << "The total is " << Total << endl;
	}
	break;
	case 5:
	cout << "Enter how many numbers you want to find the average of: ";
	cin >> Amount;

	for(int i = 0; i < Amount; i++)
	{
	    cout << "Number " << i << ": " ;
		cin >> Number;

		Total = Number + Total;
	}
	answertoaverage = Total / Amount;
	cout << "The average of those " << Amount << " numbers is " << answertoaverage << endl;
}
	cout << "enter 1 to restart or 2 to quit: ";
	cin >> restart;
	if(restart == 1){
    }else{
        break;
    }

    }

    cin.get();
	return 0;
}
For your second question, you'd have to write some sort of simple parser. That could be rather tricky and it would require you to be very familiar with the std::string class, but it's fun to see it work.

I'd suggest looking into Qt to create GUI applications. It might be a little bit intimidating at first as it is a very different world, but ultimately it's not that hard at all. Hey, maybe it's even easier. :)

Okay, I take that back. If that program really showcases *all* you know, then I don't think you're quite ready for GUI programming in C++ yet. Sorry. :(

Knowing how to use classes (including constructors/destructors) is an absolute prerequisite for using Qt. It is similarly be a prerequisite for using wxWidgets or gtkmm, which are two other major C++ GUI libraries. After that, though, you might be ready, though I'd suggest learning about inheritance and polymorphism as well.

-Albatross
Last edited on
You have a decent grasp on the basics, and I'm currently reading a book (Professional C++ 2nd Edition) that skips completely over those basics, except for a very cursory review of them in the first chapter, and then moves directly into how to design programs, and starts the code off with classes and flows from there. It includes a lot of advanced applications, as well as a thorough review of containers & algorithms, classes, inheritance, polymorphism, advanced string handling, etc.

...and even that's just barely scratching the surface of this resource. I would estimate that you've reached the approximate point where this could be an appropriate investment for you. You can get it from www.wrox.com

EDIT:
P.S.
The book also goes over what will happen and how to prevent it when your users (and they WILL) put in a non-int when you're expecting to see an int. Exceptions, ZING!
Last edited on
Albatross - after i learn classes do you know a good GUI free tutorial or video tutorial?
Also can you give me a idea fora program
that I need to use classes and multiple functions so I can learn them
Topic archived. No new replies allowed.