63 Posted Topics

Member Avatar for neoseeker191

Change the whiles to if statements, and for all purposes, exitLine is ch so make a while loop around the two statements to ask whether or not the user wants to go again. [code=c++] char yesno = 'y'; while(yesno == 'y' || yesno == 'Y') { cout << "Please enter …

Member Avatar for SeeTheLite
0
150
Member Avatar for pt_solar

Well the way I would do it is use a for loop to compare the two arrays and a bool array to track what answers are wrong. [code=c++] for(x = 0; x < 20; x++) if(correct[x] != answer[x]) wrong[x]=false; for(x = 0; x < 20; x++) { if(!wrong[x]) { cout<<x<<". …

Member Avatar for SeeTheLite
0
196
Member Avatar for pt_solar

The easiest way to do this is make a for loop and initialize an integer to 0, everytime a number greater than your integer appears, set it to that number; if not, progress with the loop. At the end you should have to largest integer. [code=cplusplus] int high = 0; …

Member Avatar for pt_solar
0
779
Member Avatar for atreides27

Although dragon is right about palindromes; you do not need to go as far as creating a third string; you can use a while or for loop to compare the the strings simulataneously and return false the moment a pair of characters differ. i.e. [code=c++] int x, y; string s1,s2; …

Member Avatar for SeeTheLite
0
146
Member Avatar for trixymix31

Have you considered using a switch or while loop? After all, you only need to go through each element once right? Well there are a multitude of ways you can approach this; one being setting a flag for each vowel to disregard it after it has been used(tedious/crude) alternatively you …

Member Avatar for trixymix31
0
99
Member Avatar for Azurkan

I remeber doing a similar program a few months ago as a joke with my friend. Our teacher asked us to create a soduku solver so we created an algorithm to test every possible combination of ansewers in a number until it was correct. What you are trying to do(or …

Member Avatar for nucleon
0
100
Member Avatar for raymyster

The beauty about stacks is that you can use them in so many ways to solve one problem; the simplest, would be to read a string in a loop and insert every '(' into a stack, while popping the stack once for every ')'. Under this logic, simply make the …

Member Avatar for VernonDozier
0
325
Member Avatar for shamila08
Member Avatar for CPPRULZ

Virtual functions used to call on private variables from another class(in my understanding) so if you have: [code=c++] class one { public: one(); virtual void getone() {return data;} private: int data; }; class two : public one { public: two(); virtual void getone() {return data;} }; [/code] you would be …

Member Avatar for nucleon
0
110
Member Avatar for jimjohnson123

What compiler are you using? Tag a system("pause"); before return 0; and see what happens. Also [code=c++] int multiplyDigits(int productOfDigit1, int productOfDigit2, int productOfDigit3, int productOfDigit4, int productOfDigit5) { int digit1 = 0, digit2 = 0, digit3 = 0, digit4 = 0, digit5 = 0, valueDigit1 = 0, valueDigit2 = …

Member Avatar for WaltP
0
1K
Member Avatar for sid78669

Have you tried it? Compile it and see how it goes. Alternatively, you can put the code under one case into a function and call it on both cases.

Member Avatar for Ancient Dragon
0
132
Member Avatar for perumar

Forgive me if I'm wrong but it appears you have not declared TotalSold yet. If you haven't encountered a similar problem already, it typically results because int TotalSold is set to a random integer(483432) for instance before you set it. So just write TotalSold = 0; in your constructor and …

Member Avatar for tux4life
0
723
Member Avatar for SeeTheLite

Hey guys, I'm Kevin, hows it going? random stuff about me: Age/sex: 16/M Hobbies: reading,swimming,writing poetry,piano,games, music Musical genres: progressive rock, hardcore/thrash, techno, trance, indie, alternative, industrial, symphonic rock, classical, thug occupation:student/lifegaurd Goals(programmingwise): I'm currently learning c++ at my school but hope to expand my repetoire to include c#, java, …

Member Avatar for jbennet
0
61

The End.