Well, I posted a few problems here on daniweb and thank god that I did so. What I had been using till now was "rusted, naff,useless" code. But after today, I am more accustomed to what the new c++ is.

Well, I am 16 years old and am studying in standard 10+2.

The problem is the way we are taught in school. In school, we still use
#include<iostream.h>,#include<conio.h>,getch(),clrscsr()...etc.etc....


Considering the fact that I have already had 1.5 years of study in c++(using the old ways), you may guess my current condition.
I referred to Siddhants guide and found it quite useful. Thanks. :)

Well, coming to the point on what I want...

If anyone could help me and provide me with link to the better tutorials on Standard and modern C++, I would be highly grateful.

Well, I don't know how to use vectors. So,a guide on vectors would be useful.

Also, a list of modern header files would be extremely useful. From my information, conio.h is not in use anymore. So, how can I use stuff like cout, cin, etc.

What are namespaces?

And a list of things and functions which are outdated now, and the new ones to replace them would be great.

Thanks a ton in advance. Any help would be greatly appreciated.

Recommended Answers

All 10 Replies

#include <iostream>

is where you will find cout, etc.

namespaces are ways to group functions - for example, the cout, etc you are looking for are in the std namespace, so you have to call them like this:

#include <iostream>

int main()
{
std::cout << "something" << std::endl;
return 0;
}

Other useful things in the std namespace:

#include <vector>
#include <string>
etc.

good luck

dave

This ebook is the most suitable for you I think, superb explanations, cool code examples, answers to most of your C++ questions... :)

What I had been using till now was "rusted, naff,useless" code.

There's nothing wrong with writing code on an old compiler. You gotta do what you gotta do, and what you gotta do isn't ever ideal. ;) It's easy for some armchair critic to complain, but you're the one who has to get the job done by any means necessary.

If anyone could help me and provide me with link to the better tutorials on Standard and modern C++, I would be highly grateful.

These two books will help.

From my information, conio.h is not in use anymore.

conio.h is used a lot. There's not a standard way to do the stuff conio.h does either. Clearing the screen, changing text color, getting a key press without typing Enter, standard C++ doesn't do any of it the same way, and the standard analogs are not as useful. If you need something from conio.h, no matter how you go about it you'll get yelled at by somebody that it isn't portable, and your code is wrong, and standard C++ is GOD, and you're stupid for not writing code exactly like them, and whatever else those guys whine about. ;)

I say you should learn how to use everything, portable or not, standard or not, and then choose the best of them for what you need to do. Being standard and portable is a great goal, but to get anything substantial done you have to compromise somewhere.

What are namespaces?

Ok, you write a library that has a function called DoStuff(). You have a friend who wrote another library that has a function called DoStuff(). You want to use both libraries. What do you do?

The easiest thing is to change the name of DoStuff() in your library to something like MyDoStuff(). Now there's no conflict between the two functions. Namespaces do the same thing without changing the name of the function. They add another piece to the puzzle of choosing which name to use.

If you and your friend both use namespaces, there won't be any conflict to start with:

namespace Friend
{
    void DoStuff();
}

namespace Me
{
    void DoStuff();
}

The full name of your friend's DoStuff() is Friend::DoStuff() . Yours is Me::DoStuff() . Both names are unique because the namespace part of the name is different.

That's it! Namespaces are a way to avoid name conflicts. :)

commented: Some of the Baddest advices I ever heard. -2
commented: Agree with siddhant3s. -2

Well, I know that guide was not exhaustive. It was not a reference material, it was just a guide.
I clearly mentioned that you will have to search for more information about specific topic on the web.
Learn to use a search engine well. There is a sticky thread about C++ books.
My personal favorite are Accelerated C++ ( non-free ) and Thinking in C++ ( a free book by Bruce Eckels)

Though I myself prefer books, you may want to start with a tutorial. But do what ever, stay away from short guides like Sams " Teach yourself C++ in X days" <-- stay away from such guides.

Also read How to Ask Question the Smart Way the link is here.

Thanks Grigor. Would check the books soon.

Thanks daviddoria for your advice.

Thanks tux4life. Would check the books soon.

Thanks Tom Gunn for your advice. Would check the book.

Thanks Siddhanth for your advice.

More advices would be appreciated.

The problem is the way we are taught in school. In school, we still use
#include<iostream.h>,#include<conio.h>,getch(),clrscsr()...etc.etc....

I say that you should avoid the use of old, non-standard libraries like "conio.h" unless you are explicitly instructed -- required -- to do so.

anyone can quickly learn to use any library function that one may given in the course of their work. But you will only be hurting yourself if you learn to rely on those non-portable functions, and then one day find all your code is broken when you try to port it to another environment.

also, when you come to ask questions on a standard-C forum like this one or any of the other major forums, you will lose the assistance of people who do not, can not, or will not use non-portable libraries such as conio.

ultimately it's your choice. personally, my choice is that i just don't even bother trying to compile anyone's code who uses non-standard libraries. I simply don't care to include those libraries on my work or home machines, and therefore i don't spend any time trying to debug examples those people might post.

> This ebook is the most suitable for you I think, superb explanations, cool code examples, answers to most of your C++ questions...
And patently wrong statement even in the first paragraph!
"Simply stated, to be a professional programmer implies competency in C++."

So all the C, Perl, Java, Python, Fortran, COBOL programmers in the world are amateur hacks?
Rubbish!

I wonder how "chummy" it gets with the Microsoft compiler, since it is hosted on their site?

@MSDN>Essential skills made easy! Written by Herb Schildt
The Art of C++ guy!!
I read that book, and didn't liked it.
bullschildt!!

I personally don't prefer any tutorials to learn C++ from scratch. A Book is a book.
Accelerated C++ is my fav for beginners.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.