Coding help

    Share

    Marzdor


    Age: 18
    Location: Hell
    Posts: 212
    Reputation: 0
    Join date: 2010-01-15

    Coding help

    Post by Marzdor on Fri Mar 12, 2010 7:56 am

    k this is one of the codes i need help with





    // ???.cpp : Defines the entry point for the console application.
    //

    #include "stdafx.h"

    #include "iostream"

    int main()
    {
    using namespace std;

    cout<< " 8888 8888888/n";
    cout<< " 888888888888888888888888/n";

    ;return 0;
    }

    Alex
    Founder


    Founder

    Age: 18
    Location: Suzhou, China
    OS: Windows
    Browser: Google Chrome
    Processor: Intel
    GPU:
    Posts: 144
    Reputation: 0
    Join date: 2009-12-29

    Re: Coding help

    Post by Alex on Fri Mar 12, 2010 11:09 am

    What the heck, whoa! this is full of mistakes >.< what were you doing Max.

    hello world application ex.1


    Code:
    // my first program in C++

    #include <iostream>
    using namespace std;

    int main ()
    {
      cout << "Hello World!";
      return 0;
    }

    Marzdor


    Age: 18
    Location: Hell
    Posts: 212
    Reputation: 0
    Join date: 2010-01-15

    Re: Coding help

    Post by Marzdor on Fri Mar 12, 2010 12:25 pm

    that is how my thing said to do it

    Marzdor


    Age: 18
    Location: Hell
    Posts: 212
    Reputation: 0
    Join date: 2010-01-15

    Re: Coding help

    Post by Marzdor on Fri Mar 12, 2010 12:29 pm

    k it still won't stay open all it does is opens then closes

    Alex
    Founder


    Founder

    Age: 18
    Location: Suzhou, China
    OS: Windows
    Browser: Google Chrome
    Processor: Intel
    GPU:
    Posts: 144
    Reputation: 0
    Join date: 2009-12-29

    Re: Coding help

    Post by Alex on Fri Mar 12, 2010 3:57 pm

    OK, it doesn't stay open because i left out part of the script. But yours is strange; i don't like the script you used cause it's junk.

    to keep the window in command prompt open you need to add the line ('pause') before the variable 0.

    here's an example!

    Code:
    include <iostream>
    using namespace std;

    int main()
    {
              cout <<"Never fear, C++ is here!"
              system("PAUSE");
              return 0;
    }




    For any book examples, you just have to add that system("pause") message before your return 0 in main....Or you could use the system("pause>nul"); as well....either will work.

    Marzdor


    Age: 18
    Location: Hell
    Posts: 212
    Reputation: 0
    Join date: 2010-01-15

    Re: Coding help

    Post by Marzdor on Fri Mar 12, 2010 5:08 pm

    k got it so now i want help on this next thing


    include <iostream>
    using namespace std;

    int main()
    {
    cout <<" 8888 8888888"//then i need it to go to the next line
    cout<<" 888888888888888888888"
    system("PAUSE");
    return 0;
    }



    so it comes out like

    8888 8888888
    888888888888888888888

    in stead of 8888 888888888888888888888888888888888

    Alex
    Founder


    Founder

    Age: 18
    Location: Suzhou, China
    OS: Windows
    Browser: Google Chrome
    Processor: Intel
    GPU:
    Posts: 144
    Reputation: 0
    Join date: 2009-12-29

    Re: Coding help

    Post by Alex on Wed Mar 17, 2010 4:29 pm

    Alright to save your files as an executable Look in the directory of your C++ project. In that directory, or in some subdirectory ('Debug' or 'Release'?) should be your exe, once it's been built.


    as for the different lines
    take as look at your current script!
    Code:
    #include <iostream>

    int main ()
    {



       std: :cout << "Hello world!" << std: :end1;
       system ("pause");
       return 0;



    Now notice something different? thats because i added "<< std: :end1;" after "Hello world!"


    now my c++ isn't working at the moment but if i know c# right if you add another line just change "end1" to "end2"

    for example


    Code:
    #include <iostream>

    int main ()
    {



       std: :cout << "Hello world!" << std: :end1;
            << "I'm below Hello world!" << std: :end2;
       system ("pause");
       return 0;

    [/code]



    if for some reason this doesn't work try this

    Code:
    std: :cout << "Hello world!" << std: :end1;
            std: :cout << "I'm below Hello world!" << std: :end2;

    As you can see the siffrence is that i added the "std : : cout"

    Marzdor


    Age: 18
    Location: Hell
    Posts: 212
    Reputation: 0
    Join date: 2010-01-15

    Re: Coding help

    Post by Marzdor on Fri Mar 19, 2010 9:45 pm

    here i think i got it to work tell me if it comes up right.

    megaupload.com megaupload.comIGK8Q2QG

    Marzdor


    Age: 18
    Location: Hell
    Posts: 212
    Reputation: 0
    Join date: 2010-01-15

    Re: Coding help

    Post by Marzdor on Fri Mar 19, 2010 9:46 pm

    for the line problem i fixed it with


    << endl << endl;



    and it worked

    Alex
    Founder


    Founder

    Age: 18
    Location: Suzhou, China
    OS: Windows
    Browser: Google Chrome
    Processor: Intel
    GPU:
    Posts: 144
    Reputation: 0
    Join date: 2009-12-29

    Re: Coding help

    Post by Alex on Fri Mar 19, 2010 10:40 pm

    Alright kool! As for the .exe it nice work I like her boobs xD great that it works now. Well Max you have completed your first program! Now it's time for the complex shit xD instead of just command prompt! other scripts require you to build your own platform.

    Marzdor


    Age: 18
    Location: Hell
    Posts: 212
    Reputation: 0
    Join date: 2010-01-15

    Re: Coding help

    Post by Marzdor on Sat Mar 20, 2010 2:28 pm

    lol

      Current date/time is Sun May 20, 2012 5:25 am