Results 1 to 14 of 14
  1. #1
    SadisticGrin's Avatar
    Join Date
    Jan 2006
    Gender
    male
    Location
    Behind you.
    Posts
    1,428
    Reputation
    10
    Thanks
    125

    Whats wrong with my code? =(

    Code:
    1: #include <iostream.h>
    2:
    3:
    4: int main();
    5: {
    6: cout <<"Hello World!\n";
    7:     return 0;
    8: }
    [CENTER]
    The Grin is in.
    [IMG]https://i33.photobucke*****m/albums/d74/sadisticgrin/The-grincopy.png[/IMG]
    I AM the Influence.

  2. #2
    Bull3t's Avatar
    Join Date
    Jan 2006
    Gender
    male
    Location
    England
    Posts
    1,527
    Reputation
    5
    Thanks
    162
    It should look like this:

    Code:
    #include <iostream.h>
    
    int main()
    {
        cout << "Hello World!\n";
        return 0;
    }
    First error is "int main();" I think it should be just "int main()" and second is you haven't put a space between "<<" and the text in parenthesis.
    Last edited by Bull3t; 07-28-2006 at 09:39 AM.





  3. #3
    arunforce's Avatar
    Join Date
    Dec 2005
    Gender
    male
    Location
    A place for amigos
    Posts
    24,703
    Reputation
    4747
    Thanks
    12,562
    My Mood
    Yeehaw
    You have to put this right after I/Ostream:

    using namespace std;

    Topic Moved.



    BRING BACK BT, BRING BACK SAGA, BRING BACK VF, BRING BACK MPGHCRAFT, BRING BACK HABAMON


  4. #4
    SadisticGrin's Avatar
    Join Date
    Jan 2006
    Gender
    male
    Location
    Behind you.
    Posts
    1,428
    Reputation
    10
    Thanks
    125
    Dude. Der thanks arun. :P
    [CENTER]
    The Grin is in.
    [IMG]https://i33.photobucke*****m/albums/d74/sadisticgrin/The-grincopy.png[/IMG]
    I AM the Influence.

  5. #5
    Bull3t's Avatar
    Join Date
    Jan 2006
    Gender
    male
    Location
    England
    Posts
    1,527
    Reputation
    5
    Thanks
    162
    Oh yeah, forgot that too! Haha.





  6. #6
    SadisticGrin's Avatar
    Join Date
    Jan 2006
    Gender
    male
    Location
    Behind you.
    Posts
    1,428
    Reputation
    10
    Thanks
    125
    And thanks Bull3t. =)
    [CENTER]
    The Grin is in.
    [IMG]https://i33.photobucke*****m/albums/d74/sadisticgrin/The-grincopy.png[/IMG]
    I AM the Influence.

  7. #7
    ~Viper~'s Avatar
    Join Date
    Dec 2005
    Location
    Up High
    Posts
    1,611
    Reputation
    15
    Thanks
    27
    and thanks to gkanth too

  8. #8
    Calard's Avatar
    Join Date
    Jun 2006
    Gender
    male
    Posts
    305
    Reputation
    13
    Thanks
    172
    Quote Originally Posted by Gkanth
    and thanks to gkanth too
    u were thinking of a solution, just forgot to post it right? Cmon, thank her 4 trying in her own special way!

  9. #9
    SadisticGrin's Avatar
    Join Date
    Jan 2006
    Gender
    male
    Location
    Behind you.
    Posts
    1,428
    Reputation
    10
    Thanks
    125
    Dude wtf someone tell me why this doesn't work still. >.>



    And calard.....her who? :P
    Last edited by SadisticGrin; 08-01-2006 at 06:23 PM.
    [CENTER]
    The Grin is in.
    [IMG]https://i33.photobucke*****m/albums/d74/sadisticgrin/The-grincopy.png[/IMG]
    I AM the Influence.

  10. #10
    jeremy6996's Avatar
    Join Date
    Jul 2006
    Gender
    male
    Posts
    154
    Reputation
    10
    Thanks
    7
    you should put

    #include <iostream>
    int main()
    {
    cout<<"whut ever text you want";
    cin.get(); //it means you press enter to close the window
    }



    dont worry im new too c++ too

  11. #11
    tednugent's Avatar
    Join Date
    Mar 2007
    Gender
    male
    Location
    /bin/src
    Posts
    3,592
    Reputation
    17
    Thanks
    610
    Or you could just make a random variable and call cin...it's kinda useless, but...it works


    Code:
    #include <iostream.h>
    using namespace std;
    
    int main()
    {
    
        int random;
    
        cout << "TEXT!!!\n";
        cin >> random; 
    
        return 0;
    
    }

  12. #12
    iverson954360's Avatar
    Join Date
    Jan 2006
    Gender
    male
    Posts
    10,280
    Reputation
    940
    Thanks
    1,656
    My Mood
    Dead
    if you keep bumping old threads imma have to have the bant stick be shoved up your ass
    Hip Hop thread Part 1 (No Longer Updated): https://www.mpgh.net/forum/316-music-...-hop-list.html
    Part 2 (No Longer Updated): https://www.mpgh.net/forum/2-general/...ad-pt-2-a.html
    Part 3: COMING SOON











  13. #13
    tednugent's Avatar
    Join Date
    Mar 2007
    Gender
    male
    Location
    /bin/src
    Posts
    3,592
    Reputation
    17
    Thanks
    610
    I haven't bumped that many old threads.

  14. #14
    Reynolds88's Avatar
    Join Date
    Aug 2007
    Posts
    6
    Reputation
    10
    Thanks
    0
    Hey i got some problem too :
    Code:
    //Main.cpp
    #include <iostream.h>
    #include <fstream.h>
    #include "test.h"
    
    
    
    int main()
    {
        write();
        return 0;
    }
    Code:
    //test.h
    #include <fstream.h>
    #include <iostream.h>
    
    
    fstream file;
    
    
    int write()
    {
        int x=0;
    
        file.open("G:\temp\test.txt", ios::out);
        file << "testing" << endl;
        file >> x;
        cout << x;
        file.close;
        
        return 0;
    }
    When i compile this i got :
    Code:
    3 G:\Dev-Cpp\InOut.cpp In file included from G:\Dev-Cpp\InOut.cpp 
     G:\Dev-Cpp\test.h In function `int write()': 
    16 G:\Dev-Cpp\test.h statement cannot resolve address of overloaded function
    How to fix it?

    Ty
    Last edited by Reynolds88; 08-03-2007 at 11:44 AM.

Similar Threads

  1. [Source Code] What Wrong with this code?
    By DaRk in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 15
    Last Post: 08-06-2011, 12:55 PM
  2. [Help] whats wrong with my code.
    By GS-HITMAN in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 10
    Last Post: 04-06-2011, 05:50 AM
  3. [Help]whats wrong with my code?
    By kibbles18 in forum C++/C Programming
    Replies: 8
    Last Post: 12-05-2010, 07:27 PM
  4. What is wrong with this code?
    By t7ancients in forum C++/C Programming
    Replies: 10
    Last Post: 10-19-2009, 01:58 PM
  5. Whats wrong with this code ?
    By bohnenbong in forum WarRock - International Hacks
    Replies: 7
    Last Post: 10-26-2007, 06:57 AM