Real newbie in need of help

This is a discussion on Real newbie in need of help within the C++ Programming forums, part of the General Programming Boards category; Hello ppl im new here , the subject say it all im beginning learning C++ and i just dont understand ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    13

    Question Real newbie in need of help

    Hello ppl im new here , the subject say it all
    im beginning learning C++ and i just dont understand why does all the books and tuts dont mention the Pause thingy cause when u compile a prog it appears , and disapear jsut after u cant even see, i had to ask someone and he said me for the Pause thingy , still dont know how to call it :P So what book (online , free plz ) would u recommend cause with learn C++ in 21 days i got errors everytime i test their examples ..

    yea i know the search button , but with what i said its not like if it was a normal *whats the best book* thread

  2. #2
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    include conio.h then use

    getch();

    at the end of your program.

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    13
    ok heres what i wrote ( Dev-C++ )

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

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


    and heres the error log

    c:\docume~1\thedar~1\desktop\c__~1\hellow~1\hellow ~1.cpp: In function `int main()':
    c:\docume~1\thedar~1\desktop\c__~1\hellow~1\hellow ~1.cpp:8: implicit declaration of function `int getchar(...)'

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    13
    How about this ..

    Code:
    #include <iostream.h>
    #include <conio.h>
    
    void main()
    {
    clrscr();                         
    cout <<"Hello C++ World!/n";      
    getch();                          
    }
    i stille get the same ****en error tho ..

  5. #5
    Registered User
    Join Date
    Jul 2002
    Posts
    3
    Originally posted by TheDarKinG
    How about this ..

    Code:
    #include <iostream.h>
    #include <conio.h>
    
    void main()
    {
    clrscr();                         
    cout <<"Hello C++ World!/n";      
    getch();                          
    }
    i stille get the same ****en error tho ..
    [code]

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

    main()
    {
    cout << " Hello World! ";
    getch();

    return 0;
    }



    -----------------------------------------------------------------------------


    this will work for u

  6. #6
    Registered User fletch's Avatar
    Join Date
    Jul 2002
    Posts
    176
    with learn C++ in 21 days i got errors everytime i test their examples ..
    I used the same book to make my transition from Turbo Pascal to C++ and every example worked fine for me.
    "Logic is the art of going wrong with confidence."
    Morris Kline

  7. #7
    Registered User fletch's Avatar
    Join Date
    Jul 2002
    Posts
    176
    Change
    Code:
    cout << " Hello World! ";
    to
    Code:
    std::cout << " Hello World! ";
    "Logic is the art of going wrong with confidence."
    Morris Kline

  8. #8
    Registered User
    Join Date
    Jul 2002
    Posts
    13
    Than its probably Dev-C++ that sux ,
    cause once again with that code i have the same error !!
    what compiler would u suggest except borland and MS stuff ?

  9. #9
    Registered User fletch's Avatar
    Join Date
    Jul 2002
    Posts
    176
    Tell me the page number in your C++ in 21 days book that you got your example from.
    "Logic is the art of going wrong with confidence."
    Morris Kline

  10. #10
    Registered User
    Join Date
    Jul 2002
    Posts
    13
    I ALWAYS got that stupid error ..

    c:\docume~1\thedar~1\desktop\c__~1\hellow~1\hellow ~1.cpp: In function `int main()':
    c:\docume~1\thedar~1\desktop\c__~1\hellow~1\hellow ~1.cpp:7: implicit declaration of function `int getchar(...)'

    what does it mean

  11. #11
    Registered User
    Join Date
    Jul 2002
    Posts
    13
    Originally posted by fletch
    Tell me the page number in your C++ in 21 days book that you got your example from.
    file://localhost/C:/Documents and Settings/TheDarKinG/Desktop/Teachc/htm/ch02.htm#Heading12


    second day HELP.CPP and FUNC.CPP

    but i think its DEV-C++ the prob

  12. #12
    Registered User fletch's Avatar
    Join Date
    Jul 2002
    Posts
    176
    You must have a different CD, because
    Code:
    #include <iostream>
    
    int main()
    {
    	std::cout << "Hello World!\n";
    	int x;
    	std::cin >> x;
    	return 0;
    }
    isn't what you wrote.
    "Logic is the art of going wrong with confidence."
    Morris Kline

  13. #13
    Registered User dead_cell's Avatar
    Join Date
    Jun 2002
    Posts
    44
    You might want to try this :

    Code:
    #include <iostream> // to stay within the constraints of ANSI C++
    #define wait() system("PAUSE");
    
    using namespace std; // once again to comply with standards
    
    int main()
    {
    cout<<"Hello, world!\n";
    wait() // remember the code above? -^
    }
    see that way, you can make a global function you can use if you're coding a really big project and you want breaks between loops or the such... But, since you're just starting out, all I can say is for you to probably invest in a little better compiler. I started out with DevCPP but when I hit the books I kept getting the same errors and I just got mad and went out and bought Visial C++.NET

    I'm not suggesting you go out and slap down $170 for a compiler, but you should look for an alternative.
    Linux is great - It does infinite loops in five seconds!

    ~Linus Torvalds

  14. #14
    Registered User dead_cell's Avatar
    Join Date
    Jun 2002
    Posts
    44

    ack

    sorry, forgot return 0; after wait()
    Linux is great - It does infinite loops in five seconds!

    ~Linus Torvalds

  15. #15
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    instead of getchar(), use getch(). and make int main(), int main(int argc, char *argv[])
    "There are three kinds of people in the world...
    Those that can count and those that can't."

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. %16 with double
    By spank in forum C Programming
    Replies: 11
    Last Post: 03-05-2006, 10:10 PM
  2. need real newbie help (operators)
    By Elderon in forum C Programming
    Replies: 4
    Last Post: 08-09-2002, 08:50 PM
  3. Programming Puns
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 44
    Last Post: 03-23-2002, 04:38 PM
  4. Replies: 7
    Last Post: 12-12-2001, 10:28 AM
  5. Real newbie with VC6 questions
    By MagiZedd in forum Windows Programming
    Replies: 8
    Last Post: 10-15-2001, 09:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21