Thread: BASIC vs. Qbasic

  1. #16
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    No return 0 needed because C++ implicitly returns 0.
    You sure you want to say that on this board? There are quite a few of "int main" buffs on this board who insist on having an int main function and the return. Besides, I dont know what compiler you use, but not putting the return 0 will give you errors and/or warnings in every single compiler I have used, so it is needed unless you are using a void main, which is not the correct way to do things.

    getch( ) is both non-standard and not needed
    I have used about 6 different C++ compilers and have yet to find one that does not support getch().

    iostream.h isn't supported by the standard anymore, make that iostream
    Not all compilers follow that standard. Also, several times iostream and iostream.h are two completely different things. For example, one time I was using the standard vector class (vector.h) in a program of mine, and decided to just tell it to include vector instead of vector.h. Well when I did that I ended getting many errors. I opened up vector, and I opened up vector.h, and they were two totally different files...vector.h turned out to be the updated one, vector was just an old junked up version that was out of date. I then looked at iostream and iostream.h, and the same case occurred there.

    I like placing the .h on mine. In my opinion it is the proper way. It states that it is a header file. Putting no extension leaves so amount of obscureness and uneasiness in me. I have yet to hear that iostream.h is not standard anymore.

    No endl needed because the BASIC script doesn't print one either (I think).
    Oh yes it does...go try it.

    getch( ) is both non-standard and not needed
    I know I already addressed this one...but I wanted to say one more thing about it. Not needed? What makes you think it is not needed? It would do you very much good to use it. I know some compilers (like M$ VC++) automatically wait for a keypress at the end of console programs to close down the console program, and therefore the getch at the end of the program is not needed, but the majority of compilers, from what I have seen, do not do that. Therefore to prevent the compiler from building, running, and closing your application almost simultaneously (this is in the case of a simple console app like this one, I am not talking about more complicated apps), you need the getch to be able to make it stop and wait for a key press and the end of the program before it shuts down the console window.
    My Website

    "Circular logic is good because it is."

  2. #17
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Originally posted by DavidP
    You sure you want to say that on this board? There are quite a few of "int main" buffs on this board who insist on having an int main function and the return. Besides, I dont know what compiler you use, but not putting the return 0 will give you errors and/or warnings in every single compiler I have used, so it is needed unless you are using a void main, which is not the correct way to do things.
    Sorry to say DavidP but vVv is right about this. In C you need to return a value but C++ implicitly returns 0.

    Bjarne Stroustrup's C++ Style and Technique FAQ
    Last edited by Monster; 12-10-2002 at 04:58 AM.

  3. #18
    Black Mage Extraordinaire VegasSte's Avatar
    Join Date
    Oct 2002
    Posts
    167
    I always thought basic was fun:

    Code:
    10 PRINT "I AM GOD!!"
    20 goto 10
    Which amusingly prints I AM GOD!! all down the screen to infinity and beyond!!

  4. #19
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    Originally posted by Monster
    Sorry to say DavidP but vVv is right about this. In C you need to return a value but C++ implicitly returns 0.

    Bjarne Stroustrup's C++ Style and Technique FAQ
    That website is great I found out many new things on it, I recommend that you all read it.
    none...

  5. #20
    Originally posted by dirkduck
    " No endl needed because the BASIC script doesn't print one either (I think). "

    Try
    PRINT "line 1"
    PRINT "next line"

    The second print will show up a line below the first. Need the endl or \n for that in C++. Personally I think BASIC is great .
    Yes, but what do you do if you want to do some calculations, then print more on the same line? It happened to me, and triggered my permenant change to C++
    -Save the whales. Collect the whole set.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. whats wrong with QBASIC...in a way
    By guyfromfl in forum C Programming
    Replies: 4
    Last Post: 06-03-2008, 02:50 AM
  2. [ANN] New script engine (Basic sintax)
    By MKTMK in forum C++ Programming
    Replies: 1
    Last Post: 11-01-2005, 10:28 AM
  3. what are your thoughts on visual basic?
    By orion- in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-22-2005, 04:28 AM
  4. visual basic vs C or C++
    By FOOTOO in forum Windows Programming
    Replies: 5
    Last Post: 02-06-2005, 08:41 PM