Thread: one error....can't find it

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    5

    Question one error....can't find it

    Code:
     
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	const int SIZE = 5;
    	int values[SIZE], counter, temp;
    	bool swap;
    
    	
    	for (counter=0; counter<SIZE; counter++)
    	{
    		cout<<"please input a number"<<endl;
    		cin>>values[counter];
    	}
    
    	do
    	{	
    		swap = false;
    		for (counter=0; counter < values[counter - 1]; counter++)
    		{
    			if (values[counter+1] > values[counter])
    			{
    				temp = values[counter];
    				values[counter +1 ] = values[counter];
    				values[counter] = temp;
    				swap=true;
    			}
    		}
    	}
    	while(swap)
    	
    }
    the error is

    error C2059: syntax error : '}'


    please help me

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Spamming too, are we?
    I think you need to take a look at the line where the error is an work your way upwards and see if you're missing something.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Captain - Lover of the C
    Join Date
    May 2005
    Posts
    341
    There's another person with the exact same problem as you: look
    Don't quote me on that... ...seriously

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I can't but help to think it's the very same one. Same username, same code...
    I wonder why...?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Looks like you're missing something after your do while loop: http://www.cppreference.com/keywords/do.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. could not find -lwsock32.lib
    By thomas_joyee in forum C++ Programming
    Replies: 8
    Last Post: 07-14-2008, 12:28 PM
  3. How to find O of threads ?
    By jabka in forum C Programming
    Replies: 3
    Last Post: 03-11-2008, 12:25 PM
  4. how do u find 2nd largest number??
    By juancardenas in forum C Programming
    Replies: 8
    Last Post: 02-14-2003, 08:28 AM
  5. Q: Recursion to find all paths of a maze
    By reti in forum C Programming
    Replies: 7
    Last Post: 11-26-2002, 09:28 AM