Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

c++

  • 18-01-2003 5:15pm
    #1
    Closed Accounts Posts: 1,718 ✭✭✭


    sorry to ask a newbie qeustion but could anyone give me some pointers on runnning c++ progs in c++builder. when i try to run the progs a cmd prompt jusst flashes up 4 a second & then vanishes. i think i have the environment set up right but im not sure. are there any paths to be setup with c++ as in java? i followed the instructions 4 setting up projects etc. but ive reached a brick wall with this the last few days ................any help appreciated
    thanx


Comments

  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    I'm not familiar with c++builder, but if it's anything like JBuilder, there should be a box in the 'Properties' section marked 'Close console window on exit'.

    If it doesn't, put

    sleep(3);

    at the end of your code and the console window should stay open for 3 seconds. :)


  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    /*try this */
    #include <iostream.h>
    #include <stdlib.h>
    
    int main(int argc,char**argv)
    {
     cout<<"I need a new job for more money .... like now dude"<<endl;
    
     system("pause");
    return 0;
    };
    
    


  • Closed Accounts Posts: 1,718 ✭✭✭whosurpaddy


    that piece of code does exactly the same thing, although i can see what u were goin 4. cmd window pops up 4 a second with no output, then vanishes.

    is this that i dont have the environment configured right or my code?

    heres the program im trying to run. can somone just confirm this works.

    /* '01 Main.cpp' */
    #include <iostream>

    /* Start of program */
    main (void)
    {
    /* Variable declarations*/
    unsigned char Age;
    long StartEnergy;
    char CharacterType;
    /* Get the Information */
    std::cout << "What is your character's age: ";
    std::cin >> Age;
    std::cout << "How much start energy: ";
    std::cin >> StartEnergy;
    std::cout << "What is the character type: ";
    std::cin >> CharacterType;

    /* Show the Information */
    std::cout << "You character is " << Age << " years old." << std::endl;
    std::cout << "Has " << StartEnergy << " of starting energy." << std::endl;
    std::cout << "And its type is " << CharacterType << "." << std::endl;
    return 0;
    }


  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    By the looks of it, it should run.

    I reckon you have an option ticked that is compiling the proggie wieredly.

    If it was Dev-C++ I'd tell you to take the tick out of where it says, "Do not create a console".

    Try opening a command prompt and cd'ing to the directory where the .exe you have compiled is and running the exe from there, and see what happens then.


  • Closed Accounts Posts: 1,718 ✭✭✭whosurpaddy


    hmmm heres all the settings i can find relating to the compiler


  • Advertisement
  • Closed Accounts Posts: 1,718 ✭✭✭whosurpaddy


    settings 2


  • Closed Accounts Posts: 1,718 ✭✭✭whosurpaddy


    settings 3


  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    Do you have bandwidth?

    Try : Dev-C++

    I'm not sure if you 'have' to use that IDE, but if not try out Dev-C++.


    In either case try directly executing the proggie from a command prompt as opposed to from the IDE.


  • Closed Accounts Posts: 1,718 ✭✭✭whosurpaddy


    what are the cmd line commands for c++?

    appreciate the help typedef. thanx


  • Registered Users, Registered Users 2 Posts: 4,676 ✭✭✭Gavin


    Compile you application using your IDE. Then at a command prompt, locate the exe and execute it...

    Gav


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,591 ✭✭✭tommycahir


    try putting
    fflush(stdin);
    getchar();
    at the end of the prog justr before the close of main


  • Closed Accounts Posts: 1,718 ✭✭✭whosurpaddy


    well after trying all of the above & several other things i thought of & going mad the last few days i took the easy option & got visual c++. i find it much easier to use.

    thanx for all the help lads particularly typedef


  • Registered Users, Registered Users 2 Posts: 660 ✭✭✭anthonymcg


    I reckon ya shoulda used java. :p


  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    Originally posted by whosurpaddy
    well after trying all of the above & several other things i thought of & going mad the last few days i took the easy option & got visual c++. i find it much easier to use.

    thanx for all the help lads particularly typedef

    No swet mate.

    Incidentally : try Dev-C++, and/or RHIDE, I think it'd be well worth your while, if only to use the mingw or cygwin ports of the GNU C and C++ compiler.

    Bod.


Advertisement