So guys, I am a math major freshmen in college. I am currently in intro to programming(CS 100), which is taught in C++. We had 20 students initially; now--one month remaining--there are about 5. Anyway, I had no prior experience in programming about 3 months ago, and I have only been practicing programming for hw, as I have little time remaining after completing hw for gen. eds. and major-specific courses. Today, I decided to test out my knowledge and skills to create a program that will estimate your age based on the input in this format: day/month/year. This program, written in about 45 minutes, assumes, 365 days in a year, 30 days in a month. This program is impressive because it separates the input string birth date into it factors: days, months, and year. Anyway, do you think I have learned enough C++ to move on to advanced courses, such as Advanced programming, etc. instead of taking CS 101? Thank you guys.
the only thing (and this is me guessing what is taught in advanced class) is make it all into a class and give it a nice interface. i would also suggest writing a container of some sort, like Array or vector, because that cements in a lot of good skills
yeah. im more of a self taught programmer (some few online stuff) and i am no where (let me repeat no where) near the best, but i have gotten pretty good by writing code every day and paying a lot of attention on this site. the members here can teach you alot
expanding on what lumpkin said: using namespace is generally a bad idea because it will bring in everything when you dont neccesarily need it like if i did using namespace std and included iostream i would have (this is a short list and by no means exhaustive)
clog
cerr
cout
cin
printf (i think)
scanf (" ")
ostream
istream
and i probably dont need all of those. there are two solutions:
using std::clog;
using std::cerr;
//... etc etc
or just prefix something with std:: when you call it. ie: std::cout<<"Hello, world!"<< std::endl;
@fred: were you talking about learning classes or my mini bio?
the only thing (and this is me guessing what is taught in advanced class) is make it all into a class and give it a nice interface. i would also suggest writing a container of some sort, like Array or vector, because that cements in a lot of good skills
I was going to reply basically the same thing, but you beat me to it.
I think it doesn't actually make the program compile slower, (the compiler would probably just leave out unused portions,) but it's just a matter of preference.
I would say to never use usingnamespace std; for the reasons DTSCode mentioned. If you don't want to do std:: throughout the code I would say use using std::cin; using std::cout; using std::endl; // etc as it saves you a lot of typing and doesn't flood the namespace with the entire standard objects.
[EDIT]
Though, learncpp.com does something that I think is a little annoying and overkill.
I'm EXTREMELY glad to see a new programmer that knows a thing or two about keeping good indenting style. Follow everything that DTSCode has been saying, and you are well on your way to learning how to program.
And when I say well on your way, I mean you've just started. I've been programming for around 3 years and I'm still learning something new every day.