+ Reply to Thread
Results 1 to 3 of 3

Thread: Basics of C++

  1. #1
    Join Date
    Oct 2009
    Posts
    120
    Points
    404,695.69
    Rep Power
    177

    Default Basics of C++

    Defines
    ---------

    #include <iostream.h>
    #define lol cout<<"Hello World!\n\n"; //Treats the word lol as "cout<<"Hello World!\n\n";

    int main()
    {
    lol
    system("pause");
    }
    Calling Functions
    -------------------

    #include <iostream.h>

    void Function()
    {
    cout<<"World!\n\n";
    system("pause");
    }

    int main()
    {
    cout<<"Hello ";
    Function(); //Calls the function
    }
    Goto Commands
    ------------------

    #include <iostream.h>
    int main()
    {
    Start:
    system("cls");
    cout<<"Hello World!\n\n";
    system("pause");
    goto Start;
    }
    Strings
    --------

    #include <iostream.h>
    #include <string>
    using namespace std;

    string x;

    int main()
    {
    cout<<"Enter a word: ";
    cin >> x;
    system("cls");
    cout<<"The word entered is: " << x << "\n\n";
    system("pause");
    }

  2. #2
    Join Date
    Mar 2010
    Posts
    39
    Points
    61,112.65
    Rep Power
    0

    Default Re: Basics of C++

    hey thanks c++ is hard but i learned something!

  3. #3
    Join Date
    Oct 2009
    Posts
    120
    Points
    404,695.69
    Rep Power
    177

    Default Re: Basics of C++

    Quote Originally Posted by tchanabc View Post
    hey thanks c++ is hard but i learned something!
    No problem

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts