I just got a student version of VS.NET and I was trying to do a simple hello world in cpp. Just to get the structure you save your files and such in. Any help? Do I create a new project or just a new file or what?
Printable View
I just got a student version of VS.NET and I was trying to do a simple hello world in cpp. Just to get the structure you save your files and such in. Any help? Do I create a new project or just a new file or what?
You'll want a win32 console project.
K, what after that?
Open the IDE
Select File->New->Project...
Select C++ Projects on the left
Select Win32 Application on the right side
Enter name
Click OK
Select Applications Settings on the left
Select Console Application on the right
Click Finish
Doubleclick on yourprojectname.cpp in the solution-explorer tree on the right to open your codefile.
Cool, thanks! So what is some simple code for a screen display I can do for a quick test? I'm so ready to start C/C++ but I feel like I'll get confused between it and Java. :( Should I wait, or should I start reading my book a little?
You could go:
#include <iostream.h>
#include <stdlib.h>
int main()
{
cout<<"Hello World!"<<endl; //Prints Hello World on Screen
system("PAUSE"); //Produces the "Press any
// Key to Continue"
}
Check out this:
http://www.cprogramming.com/tutorial.html
Hope that helps.
That's pretty cool, thanks! So the header file is kind of like inheritance in Java? You can use methods, variables and such in the cpp file if they've been delcared in the header file?
A header file is simply a file that can be 'pasted into' you'ew program... werever you use '#include' you are telling the compiler to place whatever code is in that header into you're source, the reason it has earned the name 'header' is that in C/C++ you can have multiple source(s) as well have many, many, types of imported librareis, and to tell the compiler a function exists (the linker knows this from the import libz, but the compiler does not) you do something called a function prototype (vocab correct?). Most headers just include lists of these 'function prototypes' (again, vocab correct?) and declairation of symbols needed (#define) and all the other things that library needs to have in you're source for you to make use of it.
I hope this helps, SPH
P.S. Email: [email protected] , AIM: aGaBoOgAmOnGeR
Windows is very userfriendly, lots and lots of buttons to press.Quote:
Open the IDE
Select File->New->Project...
Select C++ Projects on the left
Select Win32 Application on the right side
Enter name
Click OK
Select Applications Settings on the left
Select Console Application on the right
Click Finish
Doubleclick on yourprojectname.cpp in the solution-explorer tree on the right to open your codefile.
:D
just click new->file->C++ source file
type your code and build
and your done...it'll automatically create a project for you