C++ Beginning tutorial
2 posters
Page 1 of 1
C++ Beginning tutorial
so this is the most basic c++ to learn.. but i'm going to outline it in a very simple easy to understand way
source is saved in a .cpp file (think c plus plus) and all programs must have a function "main". you really don't need to know functions just yet but just know you need the following code in order for your program to work:
int main()
{
//this is where your code goes
}
outside of function main is where you declare global variables and preprocessor directives. for our purposes all you'll need is this: #include <iostream> which tells the compiler to include the c++ library for input/output.
you'll also need the statement: using namespace std;
c++ uses the statement "cout" to print lines // is used to insert comments that aren't compiled as code. I find the best way to learn is to do, so here's a sample program:
#include <iostream> //tells compiler to include library for input/output
using namespace std; //using standard namespace
int main() //main function
{
cout<<"Hello World!" //print line "Hello World!"
return (0); //return value 0 to operating system to indicate successful run
}
Sample Output:
Hello World!
I'll post more if people want... but i won't waste my time unless someone actually shows interest
source is saved in a .cpp file (think c plus plus) and all programs must have a function "main". you really don't need to know functions just yet but just know you need the following code in order for your program to work:
int main()
{
//this is where your code goes
}
outside of function main is where you declare global variables and preprocessor directives. for our purposes all you'll need is this: #include <iostream> which tells the compiler to include the c++ library for input/output.
you'll also need the statement: using namespace std;
c++ uses the statement "cout" to print lines // is used to insert comments that aren't compiled as code. I find the best way to learn is to do, so here's a sample program:
#include <iostream> //tells compiler to include library for input/output
using namespace std; //using standard namespace
int main() //main function
{
cout<<"Hello World!" //print line "Hello World!"
return (0); //return value 0 to operating system to indicate successful run
}
Sample Output:
Hello World!
I'll post more if people want... but i won't waste my time unless someone actually shows interest
Re: C++ Beginning tutorial
Couldn't you use printf?
The MacGuffin- Ali Babba
- Number of posts : 201
Registration date : 2010-02-18
Re: C++ Beginning tutorial
no thats not c++... but that same program in java is:
public static void main (String[]args)
{
System.out.println("Hello World!");
}
public static void main (String[]args)
{
System.out.println("Hello World!");
}
Re: C++ Beginning tutorial
Oh, duh.
Sorry I was reading C tutorials the other night. :\
Sorry I was reading C tutorials the other night. :\
The MacGuffin- Ali Babba
- Number of posts : 201
Registration date : 2010-02-18
Re: C++ Beginning tutorial
i don't understand why they put the bigger differences like that in... but i'm pretty sure c++ compilers recognize c as a language so that command is probably an option, just depreciated
Re: C++ Beginning tutorial
Nah, you actually have to start a new project in C.
Well, according to all the IDEs I've run.
Well, according to all the IDEs I've run.
The MacGuffin- Ali Babba
- Number of posts : 201
Registration date : 2010-02-18
Re: C++ Beginning tutorial
Never heard of it.
The MacGuffin- Ali Babba
- Number of posts : 201
Registration date : 2010-02-18
Re: C++ Beginning tutorial
Oh, haha, didn't recognize it right away with all that acronyming going on.
Yes, even in msvs2k8.
Yes, even in msvs2k8.
The MacGuffin- Ali Babba
- Number of posts : 201
Registration date : 2010-02-18
Re: C++ Beginning tutorial
the name is too big.. and i'm lazy... maybe it only supports certain c commands then...
Re: C++ Beginning tutorial
Maybe, too lazy to check though.
The MacGuffin- Ali Babba
- Number of posts : 201
Registration date : 2010-02-18
Re: C++ Beginning tutorial
Well, can't necessarily argue with a book.
...
Well, yes I could, but I'm not going to.
...
Well, yes I could, but I'm not going to.
The MacGuffin- Ali Babba
- Number of posts : 201
Registration date : 2010-02-18
Re: C++ Beginning tutorial
okay so looking at web hosting.. we need to know either java ruby perl .net python php or cold fusion... and we can get a pretty good deal on a domain names and web hosting with godaddy
Re: C++ Beginning tutorial
Sounds good.
.net shouldn't be too hard since that's just an extension of vb (I could be dead wrong about that).
If not php isn't so hard.
Anyway, I'm off to school.
.net shouldn't be too hard since that's just an extension of vb (I could be dead wrong about that).
If not php isn't so hard.
Anyway, I'm off to school.
The MacGuffin- Ali Babba
- Number of posts : 201
Registration date : 2010-02-18
Re: C++ Beginning tutorial
i think you're right... but idk if there is .net support for linux servers... but linux has java support so it would be worth it
Re: C++ Beginning tutorial
Definitely.
The MacGuffin- Ali Babba
- Number of posts : 201
Registration date : 2010-02-18
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|