BleepingComputer.com: nooby need help with code c++

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

nooby need help with code c++

#16 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,403
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 23 November 2008 - 10:55 AM

There are a lot of syntax errors in that code. Here's an example of one:
			  if (dsecondnumber == 0) (
				  std::cout << "invaled operation " << endl);


Blocks are identified with {}s not ()s. You also have a semicolon problem here. That correctly written would be:
if (dsecondnumber == 0) {
	std::cout << "invaled operation " << endl;
|


The specific error you are running into right now is exactly what you have right now. You have
do {
somecode
}
system("pause");

You need to put a condition on the do to tell it when to exit. If you want an infinite loop in C(++(0x)) that is typically done with a for loop like this:
for(;;) { //infinite loop
}

Billy3

#17 User is offline   i am not known 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 113
  • Joined: 17-August 08

Posted 24 November 2008 - 12:45 AM

i did do them i tested them it didn't change anything so got rid of them should i try again

also how do i use for(;;) { //infinite loop in my code

This post has been edited by i am not known: 24 November 2008 - 12:55 AM

I hear a boy only has a certain amount of tears one day the pain and dissapointment happen so often the pain dissapers and the boy becomes a man

#18 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 24 November 2008 - 06:39 AM

Quote

also how do i use for(;;) { //infinite loop in my code


You don't want to use an infinite loop....that means it gets stuck and never does anything, and never stops. Billy was pointing out an error in your code.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#19 User is offline   Billy O'Neal 

  • Bleepin Engineer GRADUATE
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Malware Response Instructor
  • Posts: 10,403
  • Joined: 17-January 08
  • Gender:Male
  • Location:Cleveland, Ohio

Posted 24 November 2008 - 06:05 PM

C++ does not have do loops. It has Do...While, While, and For loops. Do you know how to use loops?

If not I'd read the control structures documentation here:
http://www.cplusplus.com/doc/tutorial/control.html

Billy3

#20 User is offline   i am not known 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 113
  • Joined: 17-August 08

Posted 21 March 2009 - 08:01 AM

far this was posted buy me years ago ( i think )
thankyou for all your help turns out my problem was the lack of while at the end of the do as was suggested at the very start, i am sorry i have been promoted to only a little bad thanks for all your help sorry i didn't reply i dissapered for my list and i didn't realise it was still here but this is so far in the list no one will answer this. i wonder if i can find all my other stuiped questions
I hear a boy only has a certain amount of tears one day the pain and dissapointment happen so often the pain dissapers and the boy becomes a man

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users