LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-26-2003, 10:40 PM   #1
mymojo
Member
 
Registered: Oct 2003
Distribution: Slackware 9.1
Posts: 176

Rep: Reputation: 30
c++ newbie - help debug simple program please


#include <iostream.h>

int main ()

{

int mypin;
int brutepin;

mypin = 5178;
brutepin = 0000;

cout << "Trying to match PIN: " << mypin << endl;

// go through possibilities


for ( brutepin != mypin; brutepin++ );



// final check

if ( brutepin == mypin )

{

cout << "Successfully found PIN. It was: " << brutepin << endl;

}

else

{

cout << "Could not find PIN. Sorry";

}


return 0;

}
 
Old 11-26-2003, 11:33 PM   #2
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
What errors do you get when you try to compile? Hard to debug a program just by looking at it

Edit: nevermind. Your "for" syntax is incorrect. Try this:

Code:
for ( ; brutepin != mypin; brutepin++ );

Last edited by wapcaplet; 11-26-2003 at 11:35 PM.
 
Old 11-26-2003, 11:38 PM   #3
mymojo
Member
 
Registered: Oct 2003
Distribution: Slackware 9.1
Posts: 176

Original Poster
Rep: Reputation: 30
I'll give that a whirl. Thanks.
 
Old 11-27-2003, 02:29 AM   #4
mymojo
Member
 
Registered: Oct 2003
Distribution: Slackware 9.1
Posts: 176

Original Poster
Rep: Reputation: 30
Yep. It works. Thanks!

Wow! It figures it out in less than a second!

I wonder how long it would take with letters & numbers & *, -, _ etc...

That's the next step!
 
Old 11-27-2003, 04:17 AM   #5
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
There's a Cray Y-MP with a guest shell account somewhere on the net... try running it on that
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to debug GTK+ program asahlot Programming 4 10-19-2005 04:23 AM
How do i debug my c++ program please? twirl Programming 1 09-12-2005 02:34 AM
newbie needs help with simple program mastervampire Linux - Newbie 1 03-07-2005 05:26 AM
C++ Newbie stuck on first simple program webwolf70 Programming 8 09-14-2004 01:29 AM
How do I debug a C program mfeoli Programming 3 03-12-2004 01:58 PM


All times are GMT -5. The time now is 06:28 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration