C++ Beginning tutorial

View previous topic View next topic Go down

C++ Beginning tutorial

Post by TheCollectiveUnconscious on Mon May 03, 2010 7:52 pm

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

_________________
LugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeot

avatar
TheCollectiveUnconscious
Forum Tech-Wizard
Forum Tech-Wizard

Male
Number of posts : 518
Age : 26
Registration date : 2010-02-05

http://ubuntuforums.org/member.php?u=1006496

Back to top Go down

Re: C++ Beginning tutorial

Post by The MacGuffin on Wed May 05, 2010 5:32 pm

Couldn't you use printf?
avatar
The MacGuffin
Ali Babba
Ali Babba

Number of posts : 201
Registration date : 2010-02-18

Back to top Go down

Re: C++ Beginning tutorial

Post by TheCollectiveUnconscious on Wed May 05, 2010 5:34 pm

no thats not c++... but that same program in java is:

public static void main (String[]args)
{
System.out.println("Hello World!");
}

_________________
LugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeot

avatar
TheCollectiveUnconscious
Forum Tech-Wizard
Forum Tech-Wizard

Male
Number of posts : 518
Age : 26
Registration date : 2010-02-05

http://ubuntuforums.org/member.php?u=1006496

Back to top Go down

Re: C++ Beginning tutorial

Post by The MacGuffin on Wed May 05, 2010 5:36 pm

Oh, duh.

Sorry I was reading C tutorials the other night. :\
avatar
The MacGuffin
Ali Babba
Ali Babba

Number of posts : 201
Registration date : 2010-02-18

Back to top Go down

Re: C++ Beginning tutorial

Post by TheCollectiveUnconscious on Wed May 05, 2010 5:40 pm

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

_________________
LugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeot

avatar
TheCollectiveUnconscious
Forum Tech-Wizard
Forum Tech-Wizard

Male
Number of posts : 518
Age : 26
Registration date : 2010-02-05

http://ubuntuforums.org/member.php?u=1006496

Back to top Go down

Re: C++ Beginning tutorial

Post by The MacGuffin on Wed May 05, 2010 5:44 pm

Nah, you actually have to start a new project in C.

Well, according to all the IDEs I've run.
avatar
The MacGuffin
Ali Babba
Ali Babba

Number of posts : 201
Registration date : 2010-02-18

Back to top Go down

Re: C++ Beginning tutorial

Post by TheCollectiveUnconscious on Wed May 05, 2010 5:46 pm

even msvs2k8?

_________________
LugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeot

avatar
TheCollectiveUnconscious
Forum Tech-Wizard
Forum Tech-Wizard

Male
Number of posts : 518
Age : 26
Registration date : 2010-02-05

http://ubuntuforums.org/member.php?u=1006496

Back to top Go down

Re: C++ Beginning tutorial

Post by The MacGuffin on Wed May 05, 2010 5:47 pm

Never heard of it.
avatar
The MacGuffin
Ali Babba
Ali Babba

Number of posts : 201
Registration date : 2010-02-18

Back to top Go down

Re: C++ Beginning tutorial

Post by TheCollectiveUnconscious on Wed May 05, 2010 5:48 pm

visual studio

_________________
LugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeot

avatar
TheCollectiveUnconscious
Forum Tech-Wizard
Forum Tech-Wizard

Male
Number of posts : 518
Age : 26
Registration date : 2010-02-05

http://ubuntuforums.org/member.php?u=1006496

Back to top Go down

Re: C++ Beginning tutorial

Post by The MacGuffin on Wed May 05, 2010 5:49 pm

Oh, haha, didn't recognize it right away with all that acronyming going on.


Yes, even in msvs2k8.
avatar
The MacGuffin
Ali Babba
Ali Babba

Number of posts : 201
Registration date : 2010-02-18

Back to top Go down

Re: C++ Beginning tutorial

Post by TheCollectiveUnconscious on Wed May 05, 2010 5:51 pm

the name is too big.. and i'm lazy... maybe it only supports certain c commands then...

_________________
LugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeot

avatar
TheCollectiveUnconscious
Forum Tech-Wizard
Forum Tech-Wizard

Male
Number of posts : 518
Age : 26
Registration date : 2010-02-05

http://ubuntuforums.org/member.php?u=1006496

Back to top Go down

Re: C++ Beginning tutorial

Post by The MacGuffin on Wed May 05, 2010 5:52 pm

Maybe, too lazy to check though.
avatar
The MacGuffin
Ali Babba
Ali Babba

Number of posts : 201
Registration date : 2010-02-18

Back to top Go down

Re: C++ Beginning tutorial

Post by TheCollectiveUnconscious on Wed May 05, 2010 5:53 pm

i know theres some... cuz it says so in my c++ textbook

_________________
LugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeot

avatar
TheCollectiveUnconscious
Forum Tech-Wizard
Forum Tech-Wizard

Male
Number of posts : 518
Age : 26
Registration date : 2010-02-05

http://ubuntuforums.org/member.php?u=1006496

Back to top Go down

Re: C++ Beginning tutorial

Post by The MacGuffin on Wed May 05, 2010 5:55 pm

Well, can't necessarily argue with a book.


...

Well, yes I could, but I'm not going to. Very Happy
avatar
The MacGuffin
Ali Babba
Ali Babba

Number of posts : 201
Registration date : 2010-02-18

Back to top Go down

Re: C++ Beginning tutorial

Post by TheCollectiveUnconscious on Wed May 05, 2010 6:19 pm

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

_________________
LugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeot

avatar
TheCollectiveUnconscious
Forum Tech-Wizard
Forum Tech-Wizard

Male
Number of posts : 518
Age : 26
Registration date : 2010-02-05

http://ubuntuforums.org/member.php?u=1006496

Back to top Go down

Re: C++ Beginning tutorial

Post by The MacGuffin on Wed May 05, 2010 6:25 pm

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.
avatar
The MacGuffin
Ali Babba
Ali Babba

Number of posts : 201
Registration date : 2010-02-18

Back to top Go down

Re: C++ Beginning tutorial

Post by TheCollectiveUnconscious on Wed May 05, 2010 6:31 pm

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

_________________
LugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeotLugiaPidgeot

avatar
TheCollectiveUnconscious
Forum Tech-Wizard
Forum Tech-Wizard

Male
Number of posts : 518
Age : 26
Registration date : 2010-02-05

http://ubuntuforums.org/member.php?u=1006496

Back to top Go down

Re: C++ Beginning tutorial

Post by The MacGuffin on Wed May 05, 2010 8:41 pm

Definitely.
avatar
The MacGuffin
Ali Babba
Ali Babba

Number of posts : 201
Registration date : 2010-02-18

Back to top Go down

Re: C++ Beginning tutorial

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum