bit-tech.net

Go Back   bit-tech.net Forums > Technology > Software

Reply
 
Thread Tools
Old 17th Feb 2017, 21:20   #21
theshadow2001
[DELETE] means [DELETE]
 
theshadow2001's Avatar
 
Join Date: May 2012
Posts: 4,933
theshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyantheshadow2001 is a Super Spamming Saiyan
Firstly, for the love of god use the [ CODE] [ /CODE] tags. Its really hard to read code without indentation.

You have a guess word and you have a hidden word and you are trying to see if letters of the guess are in the hidden word and if they are count if they are in the right position or not.

The code uses nested for loops. For each letter in the hidden word it runs through each letter in the guess word. Within the inner loop it compares the letters to see if they are the same value. If they are the same value it then moves into the final set of if/else conditions and checks if the letters are in the same position in both words by comparing each of the index variables from both of the loops. Note that the index counter in each loop will tell you the position of the current letter being examined.

If these are code snippets from a course or book you should really be throwing them into some .cpp files, compiling them and stepping through them with a debugger to see how they work.

Last edited by theshadow2001; 17th Feb 2017 at 21:25.
theshadow2001 is offline   Reply With Quote
Old 18th Feb 2017, 18:41   #22
Archtronics
Mod Master
 
Archtronics's Avatar
 
Join Date: Jun 2006
Location: Chester or Nottingham
Posts: 2,305
Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.Archtronics is the Cheesecake. Relix smiles down upon them.
Quote:
Originally Posted by theshadow2001 View Post
Firstly, for the love of god use the [ CODE] [ /CODE] tags. Its really hard to read code without indentation.

You have a guess word and you have a hidden word and you are trying to see if letters of the guess are in the hidden word and if they are count if they are in the right position or not.

The code uses nested for loops. For each letter in the hidden word it runs through each letter in the guess word. Within the inner loop it compares the letters to see if they are the same value. If they are the same value it then moves into the final set of if/else conditions and checks if the letters are in the same position in both words by comparing each of the index variables from both of the loops. Note that the index counter in each loop will tell you the position of the current letter being examined.

If these are code snippets from a course or book you should really be throwing them into some .cpp files, compiling them and stepping through them with a debugger to see how they work.

Cheers dude, hadn't noticed the code tags before.

Its my code I've written along side the tutorials, Its more about getting my head around the process of how its working. The guy doing the videos can tend to go off on a tangent and never actually say what's happening.
Archtronics is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:45.
Powered by: vBulletin Version 3
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.