Thread: Dev C++

  1. #1
    Registered User lukas1viper's Avatar
    Join Date
    Dec 2001
    Posts
    11

    Dev C++

    When i build this code with dev c++ ver.4 it runs the program but then immediatly closes the console. what am i supposed to keep the console open?

    #include <iostream.h>
    int main()
    {

    cout << "I Love C++";

    return 0;
    }

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Go look at the FAQ on pausing applications, or perhaps search for the answer amongst the 800 other similar threads on this board

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    16

    lots of ways

    i use

    #include <iostream.h>
    #include <stdlib.h>

    int main()
    {
    cout<<"So do I"<<endl; //endl == end line == \n
    system("pause");

    return 0;
    }

    this works in dos only, system calls dos commands (or linux commands) depends on what your on. The output would be...

    So do I
    Press any key to continue...

    thats one way.
    • 0927
    • a.k.a 0 9 two 7

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    15

    Local time displayed at the wrong place

    This program is not displaying the time in the correct area
    on the DOS screen. I tried it in so many ways without success.
    Please help.
    Thank you.
    Environment: Desktop OS: Win 2K

    Here are my codes and the result that I got:

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

    // this is a good test for displaying time on the pc
    // but the time is displayed at the wrong place

    void Time(void);

    main()
    {
    Time();
    return 0;
    }
    void Time()
    {
    time_t now;
    now = time(NULL);
    cout << ctime(&now);
    }
    Result displayed on the screen: Sun Jan 27 06:33:51 2002
    Time is in the wrong place, time should be after "2002".
    Let me know if I am wrong on this.

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    106
    you're making it to hard for the guy
    don't you realize that the kid is a rookie


    try this on for size


    #include <iostream.h>
    #include <conio.h>
    #include <conio.c>

    int main()
    {
    textcolor(1);
    cout << "Whats up?" << endl;
    getch();
    return 0;
    }

  6. #6
    Seņor Member
    Join Date
    Jan 2002
    Posts
    560
    or

    #include <iostream.h>
    #include <stdio.h>
    int main()
    {

    cout << "I Love C++";

    char a = getchar(); //waits input of a char called "a"
    return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  2. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  3. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 3
    Last Post: 03-08-2004, 08:47 PM
  4. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 1
    Last Post: 03-08-2004, 05:19 PM
  5. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 09:40 PM