whats wrong with this code??

Discussion in 'Mac Programming' started by DaKyd55, Jul 16, 2010.

  1. DaKyd55 macrumors member

    Joined:
    Jul 3, 2010
    #1
    it may be the program it was working b4 but it is doing this for other bits of code too. heres what i put in and what it returns with for any code i put in any project. what should i do?:confused::confused::confused::confused::confused:
     

    Attached Files:

  2. mac2x macrumors 65816

    Joined:
    Sep 19, 2009
    #2
    Your code looks correct & works fine for me; behaves exactly as one would expect it too. Try writing it as a stand alone .cpp file (New > C++ File in Xcode...if that's what you are using).




    Code:
    /*
     *  hellow.cpp
     *  
     *
     *  Created by [] on 7/17/10.
     *  Copyright 2010 __MyCompanyName__. All rights reserved.
     *
     */
    
    
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	cout << "Hello world!!" << endl;
    
    	return 0;
    
    }
    You really don't need that end line after the cout statement. The ; is enough.


    Code:
    /*
     *  hellow.cpp
     *  
     *
     *  Created by [] on 7/17/10.
     *  Copyright 2010 __MyCompanyName__. All rights reserved.
     *
     */
    
    
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	cout << "Hello world!!";
    
    	return 0;
    
    }
     
  3. Hansr macrumors 6502a

    Joined:
    Apr 1, 2007
    #3
    Seems like a encoding problem where " isn't being registered as the correct character? Tried using a direct text file and g++ instead of CODE::Block?
     

Share This Page