Thread: while loop and compiler troubles

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    3

    Question while loop and compiler troubles

    Hi,

    I am using the DevCPP and Mingw bundle and i think there is something wrong with it. My question is, did i do something wrong or is it the compilers fault. I think i screwed up on the while loop. If I did, could someone please show me the correct way of doing it.

    this program still incomplete but when i tried compiling i got a ton of errors. First it is supposed to display a string, "commands", then it is supposed to change the value of "command_input".

    Code:
    #include <iostream>
    #include <math.h>
    #include <string.h>
    
    using namespace std;
    
    int main ()
    
    {		string display_commands ; // a string which contains all the commands which is displayed to the user later on
    		string command_input ;
    		int repeat ; //integer used for loop
    		
    		int = 1 ;
    		
    	while (repeat = 1)
    	
    	{
    		cout << display_commands <<endl ;
    		
    		
    		cout << " Type the command of the application you wish to use " ;
    		cin <<command_input ;
    		
    		cout << "Exit the new window and press enter in this window to repeat";
    		    cin.get();
        
    }      
              return 0;
    		
    
    
    }


    Attachment 9848

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    You don't have a variable name here:
    Code:
    int = 1 ;
    This is always true:
    Code:
    while (repeat = 1)
    cin uses the >> operator.
    Code:
    cin <<command_input ;

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    3
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 23
    Last Post: 04-05-2011, 03:40 PM
  2. Visual Studio Express / Windows SDK?
    By cyberfish in forum C++ Programming
    Replies: 23
    Last Post: 01-22-2009, 02:13 AM
  3. Can a "switch" be inside a loop?
    By gmk0351 in forum C Programming
    Replies: 5
    Last Post: 03-28-2008, 05:47 PM
  4. Replies: 1
    Last Post: 10-27-2006, 01:21 PM
  5. loop debug
    By stanlvw in forum C++ Programming
    Replies: 2
    Last Post: 07-28-2004, 02:59 PM

Tags for this Thread