Public Group

#### Archived

This topic is now archived and is closed to further replies.

# Any C++ newbie or wants to learn pls read

This topic is 6004 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, Anyone interested in learning C++ please take a look at my tutorial and let me know what more I can change or add so that it better targets the novice. This tutorial is geared towards the complete novice and shows them how to get Borland C++ 5.5 up and running on the Windows platform. I would really appreciate your feedback. Please goto http://www.totalcoder.com and look at the Borland C++ 5.5 tutorial, and either post your comments and/or suggestions here or on the site. Sam ----- TotalCoder http://www.totalcoder.com "Resources, tutorials, and articles for the novice, part-time, and hobbyist programmer"

##### Share on other sites
You have a typo on your #include line (the less than and greater than). Use &lt; and &gt; for less than and greater than symbols, respectively. C++ compliance issues: You should be including iostream, not iostream.h; you should also use std::cout instead of cout if you do that (or put "using namespace std" in there somewhere). Somehow I doubt you should debate whether C or C++ is better in a compiler related tutorial, but to each his own I guess.

[Resist Windows XP''s Invasive Production Activation Technology!]

##### Share on other sites
Hi Sam,
Nice one. The tutorial is OK so far. One thing I''d suggest is a few screen shots of what you should actually see as you''re going through the process. I know it might sound a bit mickey mouse, but when youre just getting started youre very unsure of yourself...
Jon

##### Share on other sites
Thanks let me make those revisions, and the screen shot ideal is a good one. I forgot about the C++ compliance issues, since Visual C++ breaks a lot of them. They always include #include it made me forget it is #include .

Also with C++ header files should be named with .hpp extension. Let me get a rewrite and I''ll repost, did you find it helpful for the newbies?

Sam
-----
TotalCoder
http://www.totalcoder.com
"Resources, tutorials, and articles for the novice, part-time, and hobbyist programmer"

##### Share on other sites
Null and Void,

I was trying not to debate whether C or C++ is better, I''m sorry it came off that way. I was merely trying to inform the reader on why I was using C++, but if it may be confusing for the newbie I''ll remove it.

Sam
-----
TotalCoder
http://www.totalcoder.com
"Resources, tutorials, and articles for the novice, part-time, and hobbyist programmer"

##### Share on other sites
void main is not valid C or C++. Using void to indicate an empty parameter list is not recommended in C++.

Psalm 137:9: "Happy shall he be, that taketh and dasheth thy little ones against the stones."

##### Share on other sites
quote:
Original post by Arild Fines
Using void to indicate an empty parameter list is not recommended in C++.

you mean
int SomeFunc(void) { ... };

right?
why not? i thought that was good form...

--- krez (krezisback@aol.com)

##### Share on other sites
Well for an explanation on why void main... is improper here is a direct quote from Bjarne on his site. Also, I am busily incorporating these changes and everything else into the first tutorial. Thanks again everyone!

quote:

Can I write "void main()"?
The definition
void main() { /* ... */ }

is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1. A conforming implementation accepts
int main() { /* ... */ }

and
int main(int argc, char* argv[]) { /* ... */ }

A conforming implementation may provide more versions of main(), but they must all have return type int. The int returned by main() is a way for a program to return a value to "the system" that invokes it. On systems that doesn''t provide such a facility the return value is ignored, but that doesn''t make "void main()" legal C++ or legal C. Even if your compiler accepts "void main()" avoid it, or risk being considered ignorant by C and C++ programmers.
In C++ main() need not contain an explicit return statement. In that case, the value returned is 0, meaning successful execution. For example:

#include

int main()
{
std::cout << "This program returns the integer value 0\n";
}

Note also that neither ISO C++ nor C99 allows you to leave the type out of a declation. That is, in contrast to C89 and ARM C++ ,"int" is not assumed where a type is missing in a declaration. Consequently:
#include

main() { /* ... */ }

is an error because the return type of main() is missing.

Sam
-----
TotalCoder
http://www.totalcoder.com
"Resources, tutorials, and articles for the novice, part-time, and hobbyist programmer"

##### Share on other sites
Why don you use Dev C++? Ive found it much eisier to use.

##### Share on other sites
I''ll give it a try, do you have a link? If not, I''ll pull it down from Google. But thanks for the information, that is what I''m looking for, before Borland, all I new was LCC, GCC, Borland, and, for work, I use MS Visual C++.

But since I''m targeting novices and hobbyist I don''t want to include VC++ from the beginning because most non-students can''t afford it. But I''ll look into Dev C++, does it have a color syntaxing IDE? I hate coding in Notepad because I don''t remember half the keywords! MS Visual C++ has spoiled me and it looks as if it has hidden many important constructs from me as well such as int main() etc... Since coding in C++ and using MFC I haven''t seen a MAIN function in eons.

Sam
-----
TotalCoder
http://www.totalcoder.com
"Resources, tutorials, and articles for the novice, part-time, and hobbyist programmer"

• 10
• 18
• 14
• 19
• 15