What are the different between C and C++. aren't they the same ? is it that C++ coding is more complex then C or C++ actually have thing like creating a new class ???
What are the different between C and C++. aren't they the same ? is it that C++ coding is more complex then C or C++ actually have thing like creating a new class ???
C++ can be seen as an extension on C. This extension makes it possible to do object orientented programming in a more easy and powerful way. Both can be used to write very simple or very complex software.
From part one of the tutorial:
I'm using Bloodshed Software's Developmental C++. When I run this code, it ask for a number, but after one is typed in the screen quickly flashes away before I can see the "you entered" part. I asked a similar question a few weeks about the "Hello world!" code because the same problem happened, I never even got to see the window appear, it just quickly flashed onto the screen then vanished again. Somebody told me to type in cin.get() at the end of the code, which worked perfectly. However, I tried to use the same solution with the above code, and the same thing happens again, I'm asked the number, I type one in, and the screen flashes away quickly.Code:#include <iostream.h> int main() { int thisisanumber; cout<<"Please enter a number:"; cin>>thisisanumber; cout<<"You entered: "<<thisisanumber; return 0; }
I'm wondering, does my compiler suck, is that the problem here? Because if not, why wouldn't the tutorial have had the cin.get() part (by the way, what is that "part" called? A command?) in the first place? For every example I've tried in the tutorial I've had the same problem.
You have to usebefore the return 0.Code:system("PAUSE");
Thanks.
But why didn't the tutorial put that in?
Because the tutorial uses Microsoft Visual C++, which doesn't need that, while the Bloodshed Dev-C++ needs that.
Oh wait, the system pause didn't work, I got this message:
Code:implicit declaration of function `int system(...)'
You'll have to include some kind of file, forgot which on it is. Try either including conio.h, stdio.h, stdlib.h, and time.h files and see what happens.
Thanks.
You know, this board is pretty tolorant of noobs and their noobishly noobish questions.
Yea, but remember, if you post code, use the code tags, or else you will get flamed really fast
yay, another person using Dev-C++!
I hope you aren't using Dev-C++ 5 Beta, if so, delete from your computer and install Dev-C++ 4. 5 is still in beta, so do NOT do anything serious in that, because it could screw up, since it is BETA. Allegro don't work in version 5 either.
And for system("PAUSE"); you must type this line in at the top of your source.
I remembered that, because Dev-C++ has a crappy way to handle getch(), it works like cin. If you don't want the press any key to continue to be displayed type >NUL before the second quotation mark.Code:#include <dos.h>
Actually, the version 5 beta does work well with Allegro, 5.3 beta anyways. I've got it set up correctly for use...but not with MSVC++.
I like sex