Thread: Help

Results 1 to 8 of 8
  1. #1
    IceGuru's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Posts
    197
    Reputation
    10
    Thanks
    13
    My Mood
    Sick

    Help

    #include <cstdlib>
    #include <iostream>
    using namespace std;

    int main() {
    double ctemp, ftemp;

    cout << "Input a celsius temp and press ENTER: ";
    cin >> ctemp;
    ftemp = (ctemp * 1.8) + 32;
    cout << "Fahrenheit temp is: " << ftemp;

    return 0;
    }
    Its meant to convert Celsius temp to Fahrenheit.....but I see it works It just closes really fast.

    I would love to change the world they just wont give me the source code



    My Gaming Clan

  2. #2
    sgtmattbaker's Avatar
    Join Date
    Jul 2008
    Gender
    male
    Posts
    85
    Reputation
    10
    Thanks
    8
    Add cin.get() or getch() before return 0; That way you wil need to hit a key before it closes.

  3. #3
    zhaoyun333's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    396
    Reputation
    11
    Thanks
    1,125
    Really popular one is system("pause");
    There are five possible operations for any army. If you can fight, fight; if you cannot fight, defend; if you cannot defend, flee; if you cannot flee, surrender; if you cannot surrender, die." - Sima Yi

  4. #4
    zeco's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Canada
    Posts
    683
    Reputation
    12
    Thanks
    78
    My Mood
    Cynical
    Quote Originally Posted by zhaoyun333 View Post
    Really popular one is system("pause");
    But the problem with system ("pause") is that it's windows only. Also i heard it's less efficient than just cin.get(); etc.

  5. #5
    m4cizpr0's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by zeco View Post
    But the problem with system ("pause") is that it's windows only. Also i heard it's less efficient than just cin.get(); etc.
    The problem with system("pause") is that is has to go allocate memory in your actual system, then pause everything your doing. This can add up to slower run-time in the long run.

  6. #6
    IceGuru's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Posts
    197
    Reputation
    10
    Thanks
    13
    My Mood
    Sick
    That didn't work and I had too add ";" b4 return or it would compile after i did what you said? .....mind post the code whole so I see if i am doing it right?

    I would love to change the world they just wont give me the source code



    My Gaming Clan

  7. #7
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by m4cizpr0 View Post
    The problem with system("pause") is that is has to go allocate memory in your actual system, then pause everything your doing. This can add up to slower run-time in the long run.
    seems to me if you want to pause it, runtime isn't a big issue. Anyway I didn't know that. I will add it to my code from now on.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  8. #8
    IceGuru's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Posts
    197
    Reputation
    10
    Thanks
    13
    My Mood
    Sick
    IT WORKED ...thx guys

    I would love to change the world they just wont give me the source code



    My Gaming Clan

Similar Threads

  1. [Help Request] Combat arms Vid help
    By djw111 in forum Combat Arms Help
    Replies: 4
    Last Post: 12-24-2011, 05:06 PM
  2. [Help Request] AFK Bot [help]
    By fet in forum Combat Arms Help
    Replies: 7
    Last Post: 04-28-2011, 03:17 AM
  3. [Help Request] Injector Admin help
    By asdfgas in forum Combat Arms Help
    Replies: 4
    Last Post: 04-27-2011, 06:12 PM
  4. [Help Request] Ajuda / Help
    By - Battery' in forum Combat Arms BR Coding Help
    Replies: 3
    Last Post: 04-22-2011, 07:15 PM
  5. [Help Request] Help my!
    By Windowns7 in forum Combat Arms BR Coding Help
    Replies: 2
    Last Post: 04-18-2011, 01:41 PM