Whats wrong with the "If" statement here?

Pages: 12
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
#include <cstdlib>
#include <iostream>
using namespace std;

char play, PLAY, Play;
char ans;
char user[100];
int iD;
char CorrectUser[100];
int iD2;

int main()
{
//Begining of the Chaos
	cout << "ChAoS ReIgN" << " V0.99" << " THE ANSW7R LIES W7THIN" << "\n";
	cout << "Please type in username to receive custom serial or Identify Yourself" << "\n";									//Username Insert point
		gets(user);																					//Username Input point
			cout << "If " << user << " is your username please Input 1 and press enter." << "\n";	//Username Display
			cout << "If this is not your username please Input 0 and press enter." << "\n";
				cin >> iD;																			//Begining of Question-Is Input Correct?
				if(iD==1)goto Correct;
				else if(iD==0)goto Wrong;													
				else if(iD==77)goto Crack;

//If the username is Correct the User lands here.
Correct:
					cout <<"\n" << "Your Serial number is:" << " " << rand() << "\n";				
					goto Finish;
//If the username is Wrong the User lands here.
Wrong:
					cout << "Please input correct username," << "\n";
						cin >> CorrectUser;
							cout << "Is " << CorrectUser << " correct?" << "\n";							//Username Display
							cout << "Input 1 for yes, 0 for no and Press enter." << "\n";
								cin >> iD2;																			//Begining of Question-Is Input Correct?
									if(iD2==1)goto Correct;
									else if(iD2!=1)  goto Wrong;							//"goto" sends the user to specific region[labeled]

//If all goes according to plan then here's the finsh line.
Finish:
					cout <<"\n" << "Enjoy The Random Number :D";


//The secret codes sends you here
Crack: 	
					
					cout << "Nothing is as it seems," << "\n";
					cout << "Believe no one, Trust no one." << "\n";
					cout << "What is 'Life'?" << "\n";
					cout << "The answer lies Within the Game...." << "\n" << "\n";
					goto One;

		One: 
			
						cout << "Before sarcasm, man made due with OPPOSITES...\n";
						cout << "Sarcasm has become increasingly popular due to figures in society, \n";
						cout << "The most recent notability being Hugh Laurie. \n";
						cout << "His WORK being not so much Inspirational as Entertaining. \n";
						cout << "Yet he still manages to captivate and hold. A True Ambassador for Sarcasm.\n";
						cout << "Answer:"; 
							cin >> ans;
								if(ans==play, ans==Play, ans==PLAY) goto Two;
								else if(ans!=play, ans!=Play, ans!=PLAY) goto One;
		Two:
						cout << "Life, A constant Revolution Through Time.";



	   		

cout <<"\n";
system("PAUSE"); //View Progress
return 0;

}


i tried using gets(ans);
but that doesnt work either...
it compiles but if i type a wrong answer eg wow it will display part one 3 times.
if i type the right answer it will still display part one 4 times instead of shifting to part 2.
Last edited on
Variable ans is type char. So it only reads in ONE character.

As are your variables play, Play and PLAY.

I suspect you mean this:

1
2
3
4
5
std::string ans;

cin >> ans;
if(ans=="play" or ans=="Play" or ans=="PLAY") goto Two;
else if(ans!="play" and ans!="Play" and ans!="PLAY") goto One;


However just as important is your use of goto. Where did you get the idea to use that?

The goto statement is rarely needed and is making the flow of this program hard to follow. I recommend removing the goto statements first and then asking people to try to help you fix your code.

Last edited on
Yea i was initially just fooling around then i came up with the idea of making a "game" in cmd..one thing led to the next so i started using goto.
Truth is i dont really know an alternative to "goto" so you're welcome to share one with me.
Also im not really sure what "std:: string ans;" does...so if you could break it down that would be great :)...
Last edited on
A std::string is a string from the standard string library. You use it by putting this include in your code:

1
2
3
#include <string>

std::string text = "Any text you want";


You can get input into strings like this:

1
2
3
std::string user;

std::getline(std::cin, user); // input name into std::string user. 


To avoid goto you need to look at using if-blocks, and various loops:

1
2
3
4
5
6
7
8
if(ans == "play")
{
    // do stuff for play option
}
else
{
    // do non-play option stuff
}


I recommend getting a basic book or going through some basic tutorials in order to get the idea of how to design the program flow using loops and conditional blocks.
1
2
3
cin >> Ans;
			if(Ans == "play") goto Two;
			else if(Ans != "play") goto One;


I made Ans into a string, now it works, Thanks! :D...
I'll use goto for now, once i finish writing the whole thing i'll find an alternative.
I'll use goto for now, once i finish writing the whole thing i'll find an alternative.

That is a really bad way of doing things, and chances are you won't because it's actually mroe effort.

Here is a link to tutorials: http://www.cplusplus.com/doc/tutorial/control/

Please follow this advice! You will be endlessly criticised when posting code involving goto's.
Okay fine. How would you go about it then?
Im not that good at loops etc but if theres a clean way of doing this i'll give it a shot.
I'd recommend you take a look at this as well. This will help with reducing the pain of going from gotos to loops.
http://cplusplus.com/doc/tutorial/functions/

Read what mcleano linked you to as well. It should be nearly painless to convert from blocks of gotos to loops and functions, in most cases for determining what to write in your functions, you can just copy the code in the blocks and then replace gotos with another function being called (except if you need to call a function from inside itself; this is also frowned upon; this isn't LISP; insert the code in a while loop, add a break statement at the end of the code in the loop, and replace the goto with a continue).

-Albatross
Last edited on
Okay i went and read those links you gave me. The thing is i dont understrand how a loop would help if im trying not use numbers.
And after i went ahead and continued using the goto statement "en masse" i got stuck and it was all jumbled up.In a last desperate try to get it to work i held ctrl+z for a minute to get this, a last working page of code...so im really hoping someone could just start me off so i get the hang of it...

Heres what i patched together,
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
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

char play, PLAY, Play;
char ans;
char user[100];
int iD;
char CorrectUser[100];
int iD2;
std::string Ans; std::string Ans2; std::string Ans3; std::string Ans4; std::string Ans5;

int main()
{
//Begining of the Chaos
	cout << "ChAoS ReIgN" << " V0.99" << " THE ANSW7R LIES W7THIN" << "\n";
	cout << "Please type in username to receive custom serial or Identify Yourself" << "\n";		//Username Insert point
		gets(user);																					//Username Input point
			cout << "If " << user << " is your username please Input 1 and press enter." << "\n";	//Username Display
			cout << "If this is not your username please Input 0 and press enter." << "\n";
				cin >> iD;																			//Begining of Question-Is Input Correct?
				if(iD==1)goto Correct;
				else if(iD==0)goto Wrong;													
				else if(iD==77)goto Game;

//If the username is Correct the User lands here.
Correct:
					cout <<"\n" << "Your Serial number is:" << " " << rand() << "\n";				
					goto Finish;
//If the username is Wrong the User lands here.
Wrong:
					cout << "Please input correct username," << "\n";
						cin >> CorrectUser;
							cout << "Is " << CorrectUser << " correct?" << "\n";			//Username Display
							cout << "Input 1 for yes, 0 for no and Press enter." << "\n";
								cin >> iD2;													//Begining of Question-Is Input Correct?
									if(iD2==1)goto Correct;
									else if(iD2!=1)  goto Wrong;							//"goto" sends the user to specific region[labeled]

//If all goes according to plan then here's the finsh line.
Finish:
					cout <<"\n" << "Enjoy The Random Number :D";
								goto END;

//The secret codes sends you here


Game:
					
					cout << "Nothing is as it seems," << "\n";
					cout << "Believe no one, Trust no one." << "\n";
					cout << "What is 'Life'?" << "\n";
					cout << "The answer lies Within the Game...." << "\n";
					goto One;

		One: 
			
						cout << "\n" << "Before sarcasm, man made due with OPPOSITES...\n";
						cout << "Sarcasm has become increasingly popular due to figures in society, \n";
						cout << "The most recent notability being Hugh Laurie. \n";
						cout << "His WORK being not so much Inspirational as Entertaining. \n";
						cout << "Yet he still manages to captivate and hold. A True Ambassador for Sarcasm.\n";
						cout << "Answer:"; 
							cin >> Ans;
								if(Ans == "play") goto Two;
								else if(Ans != "play") goto One;
		Two:
						cout << "\n" << "Life, A constant Revolution Through Time.\n";
						cout << "From dusk till dawn, The light comes out only to hide again.\n";
						cout << "'For the night is long, wont you come out and play?' \n";
						cout << "The foolish will walk the alleys and face the consequences.\n";
						cout << "Answer:";
							cin >> Ans2;
								if(Ans2 == "no")goto Three;
								else if(Ans2 != "no")goto Two;
		Three:
						cout << "\n" << "106BC-43BC.\n";
						cout << "In times of war, The law falls silent.\n";
						cout << "Lots said is mis-understood, So was Cicero.\n";
						cout << "Inter arma enim silent leges.\n";
						cout << "Sometimes you musn't look past the actual words.\n";
							cin >> Ans3;
								if(Ans3 == "silent enim leges inter arma")goto Four;			//Doesnt work???
								else if(Ans3 != "silent enim leges inter arma")goto Three;
		Four:
						cout << "Heres where i've reached.";
	   		
END:
						cout << "\nBye";
cout <<"\n";
system("PAUSE"); //View Progress
return 0;

}

Last edited on
You don't need to iterate anything with a loop. Personally, I use goto from time to time for kicks, but when I do I mark the tag with huge letters reading tag for goto exists here and the goto with massive letters reading goto exists here and indent everything. However, that doesn't mean they're the best practice; this forum has already established that I am evil; for more serious projects I don't use them; I never use them when giving someone else a piece of code written by me.

Use loops simply because they're considered good practice and they make your code more readable by other people if for no other reason.

I will give a tips for putting your code in a forum-acceptible state.

An infinite-per-definition while loop with an if-else statement (one of which containing a break statement) would be good for replacing the code with the tags Correct: and Wrong:. The tags Game:, One:, Two:, and Three: are easily encompassable in functions that have infinite-per-definition while loops (terminatable by the break statement). Finish: and End:'s function counterparts require no loops.

-Albatross
Last edited on
Ahh okay, i'll look into that tomorrow morning as i'm too tired now.
Considering i have no clue about "infinite-per-definition" while loops if you have a chance too sum it up that would be great otherwise i'll google it..
Thanks for the help this far.
I think by "infinite-per-definition" he just means a loop that is always true, that you have to break manually. I could be wrong though.
@Bo Pace: Right.

An example of an infinite-per-definition loop:
while (true) {...}

This loop will continue forever OR (exclusively) until you reach a break statement somewhere in that loop. Or the program could crash, but unless you're doing something stupid in the loop that shouldn't happen.

-Albatross

EDIT: Misspelled my name. Oops.
Last edited on
Okay so i've tried switch statements until i realised it only works with numbers..
I have no clue how a loop will work here since the for loop only works with numbers(?)...the while loop wont help more than the if is helping right now(?)...and the do while loop... pretty much no clue on that one..
Those are all the loops ive come across, if theres another one thats useful in this case im all ears cause i have no clue how to continue, Actually the goto is working the problem im having is the last one in Three: i cant use the string to answer the if statement.
Anyone?
Thanks Albatross for the help, im just unclear on whether exchanging the if with while will help.
OK, I'm going to proceed to list off tons of tips, improvements, errors, bad practice, etc... I hope you don't mind, and if you do just skip this post!

1. If you include using namespace std;, then you don't need to put std:: in front of things from the standard namespace. Likewise, if you use std:: then you don't need using namespace std;

2. This:
1
2
3
4
5
6
7
char play, PLAY, Play;
char ans;
char user[100];
int iD;
char CorrectUser[100];
int iD2;
std::string Ans; std::string Ans2; std::string Ans3; std::string Ans4; std::string Ans5;

Should be something more like:
1
2
3
char play, Play, PLAY, ans, user[100], CorrectUser[100];
int iD, iD2;
string Ans, Ans2, Ans3, Ans4, Ans5;

Meaning you can declare multiple variables of the same type, on the same line, delimited by commas.

3. cout << "ChAoS ReIgN" << " V0.99" << " THE ANSW7R LIES W7THIN" << "\n"; doesn't need to be split into multiple strings, i.e. you can do this instead:
cout << "ChAoS ReIgN V0.99 THE ANSW7R LIES W7THIN\n";
(BTW, you can use \t to feed Tab characters to cout (meaning display a tab on screen))

4. gets(user); and cin >> user; are interchangeable. But in the interests of good practice, you should only use one or the other, not both. I would suggest you stick to cin, unless you're specifically writing a C program, not C++. gets, fgets, printf, etc, are all from C, not C++

5. You don't have to use cout multiple times for something like:
1
2
3
4
cout << "Nothing is as it seems,\n";
cout << "Believe no one, Trust no one.\n";
cout << "What is 'Life'?\n";
cout << "The answer lies Within the Game....\n";

You can do this instead:
1
2
3
4
cout << "Nothing is as it seems,\n"
     << "Believe no one, Trust no one.\n"
     << "What is 'Life'?\n"
     << "The answer lies Within the Game....\n";

Note that I omitted the ending semicolons except for the very last one. To the compiler they are essentially all on the same line, it doesn't care about newlines, only semicolons.

6. Instead of using system("PAUSE"); you should use something internal, like getch(). Look here:
1
2
3
4
5
6
7
8
9
#include <iostream>
#include <conio.h>
using namespace std;

int main() {
cout << "Press any key to exit..." << endl;
getch();
return 0;
}


The main problem with making a system() call is that its a big resource hog, the system has to put the program on hold, invoke shell (DOS in this case), then DOS has to find the PAUSE command, then PAUSE creates a process and waits for input (with PAUSE's implementation of that, which is horrid compared to cin), not to mention it's just plain 'ol Bad Practice to outsource your tasks to external programs unless you absolutely have to. C++ has all you need to pause the program (as well as many other things that can be done with windows commands). I've seen c/c++ source that has so many system() calls that it might as well have been a batch file (and that probably would have been more efficient and much less code, if you wanna call it code).
Anyway if you wanna know more about pros and cons of system() then hit up Google.

7. As was said before, you shouldn't use goto's, but use functions and control structures instead.

And finally, here is a modified version of your code (I probably did a few more things that I haven't explained, but I hope you can figure it out yourself, then it's just a matter of working it to your needs (kinda like working clay, or putty)). But one thing that's pretty notable; I got rid of a bunch of your variables, because you really don't need them, you can re-write to the same variables multiple times (that's why they're called variables).
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
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

string user, ans;

int main() {
  cout << "\nChAoS ReIgN V0.99 THE ansW7R LIES W7THIN\n\n";

  while (ans != "y" && ans != "yes" && ans != "g" && ans != "game") {
    cout << "Username: ";
    cin >> user;
    cout << "Your username is " << user << ". Is this correct? ";
    cin >> ans;
  }
  if (ans == "y" || ans == "yes") {
    cout << "\nYour Serial number is " << rand() << "\n\n";
    cout << "Press any key to exit...";
  }
  if (ans == "g" || ans == "game") {
    cout << "Nothing is as it seems,\n"
        << "Believe no one, Trust no one.\n"
        << "What is 'Life'?\n"
        << "The answer lies Within the Game....\n";

    while (ans != "play" && ans != "PLAY" && ans != "Play") {
      cout << "\nBefore sarcasm, man made due with OPPOSITES...\n"
          << "Sarcasm has become increasingly popular due to figures in society, \n"
          << "The most recent notability being Hugh Laurie. \n"
          << "His WORK being not so much Inspirational as Entertaining. \n"
          << "Yet he still manages to captivate and hold. A True Ambassador for Sarcasm.\n"
          << "answer: ";
      cin >> ans;
    }
    while (ans != "no" && ans != "NO" && ans != "No") {
      cout << "\nLife, A constant Revolution Through Time.\n"
          << "From dusk till dawn, The light comes out only to hide again.\n"
          << "'For the night is long, wont you come out and play?' \n"
          << "The foolish will walk the alleys and face the consequences.\n"
          << "answer: ";
      cin >> ans;
    }
    while (ans != "test") {    // This has to be a single word, no spaces, and I don't know why...
      cout << "\n106BC-43BC.\n"
          << "In times of war, The law falls silent.\n"
          << "Lots said is mis-understood, So was Cicero.\n"
          << "Inter arma enim silent leges.\n"
          << "Sometimes you musn't look past the actual words.\n";
      cin >> ans;
    }
  }
  cout << "\nPress any key to exit...";
  getch(); // Pause program; wait for any key;
  return 0;
}


I can't get around that problem with the last conditional.... It won't accept any string with spaces in it, and I can't figure out why.
Last edited on
You would know if you read a book on C++ before writing a program. To my belief, no decent C++ book teaches goto as a control structure.

You would also know that a for loop doesnt only work with numbers...!!!

As for your question, Part One is printed because the code in Crack label takes it to One from line 51 and many more goto chaining like that...

This makes what is called a spaghetti code.
Well, I figure he got the goto idea from batch files... We all know how that goes.

And we all know he hasn't read a C++ book. So what? Neither have I, and I'm doing fine.

We all started from scratch, doing stupid things that we would now look back on and say "wow was I that dumb?". And I don't know about you, but I learned as I went. I would make mistakes and learn from them. And I found my own ways of doing things, rather than copying somone else's ways.

Don't criticize him for being a n00b.
Last edited on
@RyanCaywood
Wherever he may have got the idea from, he may well have done some C programming before and used goto...

The point is about learning a language features systematically rather than going all out with a big program.

He is not even helped by telling to replace multiple cout statements by a single one and by declaring many variables together on the same line and replacing system("PAUSE") with getch().
He is not even clear about the difference between "if" and "while" because he doesnt understand the difference between a condition and loop.
He is not clear with the idea of putting code in blocks and using functions to call it.
All this would come by reading a book or an online tutorial.

All of the initial responders to the post have very well provided links to the suitable reference pages to learn how it works. One needs to be able to use the books and manuals. Nobody expects you to be well versed with every library function on that.

You are doing fine doesnt mean that anyone can be fine without going about it systematically. Don't give your example for not reading a book or an online reference. His conditions and requirements can be different than yours and mine.
Just because some dropout stories became successfull doesnt mean that everybody can succeed like them.

P.S. And as for his and yours unability to get the last conditional working, cin just gets a word till it reaches a whitespace. You need to use getline to read a sentence as pointed out very early in the post by Galik.


EDIT: Neither do I know about you, but I know one thing for sure that learning is going to be constant for you as well as for me... Reading books is not copying, but providing code is definitely a way to encourage it.
Last edited on
Thanks Ryan, My post said just start me off and let me handle it along the way. The fact is i never said i am a pro. Neither did i point out that im any good at this. I just started 2 weeks ago and i have school, exams, a social life and im have to get my priorities straight cos i only have one last year of school left. Yes providing code may not be the best thing but in my next App i'll think back and say "ohh yea thats how i solved it the first time"...i wasnt great with using while, But after seeing how its being used, in a scenario i actually understand makes it abit easier. And no i dont take classes or any sort of hardcopy help. All i have is the Microsoft beginners guide. Its kinda the reason i posted in the "beginners" section, i thought thats where people who have just started go to find help.

As for the goto function. I found that when i was searching up strings etc because no one explained it the Way Ryan did. Had he answered from the beginning i wouldnt have them in it now. Albatross did a fairly good job at helping simply by trying to direct me in the right way.

And as for Mgupta, maybe no "decent" c++ book teaches goto as a control structure. And if you look at my post you'd see next to me saying loops only worked with number i put a nice shiny--- (?)....So maybe instead of acting so hard here, simply correcting me would've done it too... And To Be Honest i dont care whether using goto will make my code hard to read. First i want it to work then i can go ahead and manicure it for you...Using what Ryan gave me i'll try correct my current code and continue to make more complex ones using more and more of what im learning.

EDIT:

Here's what i ended up with after Editing it,

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
#include <cstdlib>
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

char play, PLAY, CorrectUser[100], Play, ans, user[100];
int iD, iD2;
string Ans, Ans2, Ans3, Ans4, Ans5, AnsX;

int main()
{
//Begining of the Chaos
	cout<< "ChAoS ReIgN \tV0.99 \tTHE ANSW7R LIES W7THIN" << "\n"
		<< "Please type in username to receive custom serial or Identify Yourself" << "\n";		//Username Insert point
		cin >> user;																				//Username Input point
			cout<< "If " << user << " is your username please Input 1 and press enter." << "\n"			//Username Display
				<< "If this is not your username please Input 0 and press enter." << "\n";
				cin >> iD;																			//Begining of Question-Is Input Correct?
				if(iD==1)goto Correct;
				else if(iD==0)goto Wrong;													
				else if(iD==77)	
				{	
	
					cout<< "\nNothing is as it seems," << "\n"
						<< "Believe no one, Trust no one." << "\n"
						<< "What is 'Life'?" << "\n"
						<< "The answer lies Within the Game...." << "\n";			
						
						while(Ans=="play") {
						cout<< "\n" << "Before sarcasm, man made due with OPPOSITES...\n"
							<< "Sarcasm has become increasingly popular due to figures in society, \n"
							<< "The most recent notability being Hugh Laurie. \n"
							<< "His WORK being not so much Inspirational as Entertaining. \n"
							<< "Yet he still manages to captivate and hold. A True Ambassador for Sarcasm.\n"
							<< "Answer:"; 
								cin >> Ans;
						}
						while(Ans2=="no") {
						cout<< "\n" << "Life, A constant Revolution Through Time.\n"
							<< "From dusk till dawn, The light comes out only to hide again.\n"
							<< "'For the night is long, wont you come out and play?' \n"
							<< "The foolish will walk the alleys and face the consequences.\n"
							<< "Answer:";
								cin >> Ans2;
						}
						while(Ans3== "silent enim leges inter arma") {	
						cout<< "\n" << "106BC-43BC.\n"
							<< "In times of war, The law falls silent.\n"
							<< "Lots said is mis-understood, So was Cicero.\n"
							<< "Inter arma enim silent leges.\n"
							<< "Sometimes you musn't look past the actual words.\n";
								getline(cin, Ans3);
						}
		
						cout << "Heres where i've reached.";

				}

//If the username is Correct the User lands here.
Correct:
					cout <<"\n" << "Your Serial number is:" << rand() << "-" << rand() << "-" << rand() << "-" << rand() << "\n";				
					goto Finish;
//If the username is Wrong the User lands here.
Wrong:
					cout << "Please input correct username," << "\n";
						cin >> CorrectUser;
							cout<< "Is " << CorrectUser << " correct?" << "\n"			//Username Display
								<< "Input 1 for yes, 0 for no and Press enter." << "\n";
							cin >> iD2;													//Begining of Question-Is Input Correct?
									if(iD2==1)goto Correct;
									else if(iD2!=1)goto Wrong;							

//If all goes according to plan then here's the finsh line.
Finish:
					cout <<"\n" << "Enjoy The Random Number :D";
										goto END;

//The secret codes sends you here



	   		
END:
						cout << "\nBye";
cout <<"\n";
_getch(); //View Progress
return 0;

}


Now i cant use the Questions. I tried a switching a few things around but that didnt work.

I partly got rid of the goto's just left a few since at that point the app didnt work anyway...
Last edited on
@mgupta

I don't really feel like replying to all of what was said between us, but I will say that for the most part I agree with you, and you are right. You're right about learning it the right way, if that's the right way for him. However, as for providing that code to him... I merely gave him a reference point to learn from. And that is obviously what he's doing. This isn't some homework assignment, where I'm just doing it for him... I wouldn't do that, but it's pretty clear this is about learning. He wants to learn C++, not pass a class. And if he wants to learn, then he's not going to just take my code, he will make his own. Even adapting mine, is still making his own work. So I have no problems with it.
Pages: 12