About "C++ in 21 day"

So i bought this book and im having troubles in writting programs.I always write the same as they wrote, and im always getting different errors, im using Dev-C++ compailer. Can someone help?
Hi bogdanplusplus, without additional details such as the errors you get, the code you use, etc... it is going to be difficult to help you.
Arlight so, here's one. http://prntscr.com/27zdul
Maybe it depends of a compailer or book is just wrong
@bogdanplusplus

The only mistakes I see in your posted program, is you never put a semi-colon after int x = 5 and after int y = 7.
should be..

1
2
int x = 5;
int y = 7;


After looking at your code again, I think you also put a space between the back slash and n. There should be no spaces, just cout << '\n';
Last edited on
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
using namespace std;
int main()
{
int x=5;//<<<<semicolon
int y=7;//<<<<semicolon
cout<<"\n";//<<<<"<<"
cout<<x+y<<" "<<x*y;
cout<<"\n";//<<<<"<<"
return 0;
}
┬┐screenshot?
code is text
error messages are text
your problem is not graphic related
┬┐why did you think it was a good idea to post an image?
The problem is the book. Trash it.

Good books
http://www.cplusplus.com/articles/GLzyhbRD/


Also, the tutorial here is very good.
http://www.cplusplus.com/doc/tutorial/
The book you have is fine for starting. Do not listen to Duoas with regards to the beginner book on c++.

"Programming: Principles and Practice Using C++ by Bjarne Stroustrup"

This book is a great book but I would not recommend it to someone just learning as it is very in depth, it has no solutions for the exercises and deals with some advanced stuff very early, which means it is hard to follow.

As pointed out above the issues you are having are not with the book, they are related to your typing of the program. I can sympathise with you as it is hard to understand where the errors are when you first start out and do not know how the language works.
The book you have is fine for starting. Do not listen to Duoas with regards to the beginner book on c++.

Okay, jerk, here you go.

For starters: Amazon.com.
Check out the comments on the book. It is pretty self-evident that the book is trash.
http://www.amazon.co.uk/Sams-Teach-Yourself-21-Days/dp/067232072X

How about this one from a teacher:
http://www.cs.technion.ac.il/users/yechiel/CS/BadBooksC+C++.html

The book is ancient, and does not properly address proper programming.

Shall I now go tell others not to listen to you when you offer replies? Chances are that big number after my name will be much more devastating to your argument even if I make absurd statements about your (supposed) lack of knowledge.

Perhaps some tact would be more beneficial to your argument. Something along the lines of

"Well, the book isn't that horrendous. It is old, and has some mistakes, but it gets you going pretty quickly. Here's some good stuff I read about it online. <links> Also, I read it and it helped me a lot."

It's certainly less rude and aggressive than putting down other's comments with nothing more than an "because I said so" rationale.

You might even ask me why I dislike the book.
Hi Duoas my response was not a personal attack on you and I apologise if I offended you.

You link to Amazon reviews and claim that it is self evident that the book is trash. However, the reviews do not back up your claim and in fact say the opposite.

The book has 5 star [45], 4 star [27], 3 star [11], 2 star [8], 1 star [13] and overall [4 star]. This would suggest that majority of readers found the book to be of a fairly high standard and when you read the comments it is clear that this book is aimed at someone just starting out.

I actually have experience of both books and I found the c++ in 21 days to be a good introduction to the C++ language. On the other hand I found the Bjarne Stroustrup to be more aimed at experienced programmers who want to learn the C++ language in great depth.

If you actually read the comments of the book you suggested then you will see that most people who wrote a review back up what I said, this is not a book for beginners, nor is it a tutorial.

I actually gave a brief explanation of why I thought your suggestion was not good for the OP.

This book is a great book but I would not recommend it to someone just learning as it is very in depth, it has no solutions for the exercises and deals with some advanced stuff very early, which means it is hard to follow.


When you are trying to help someone learn you need to understand what level they are currently operating and what their previous knowledge is. Going on what the OP said it is clear they are just starting C++ and I feel your suggestion would be completely overwhelming to a novice C++ programmer.

My background in C++ is that I used the language to write programmes for solving physics problems and I only used a small part of the language to do so. I have not done any programming for a number of years, that is until I came back to study for a software development course. At the insert I bought the book you suggested and it was obvious after the first 3 chapters that this book was not suited to my current level of understanding and I made the decision to return to it once I get more competent and knowledgable with the language.

I stand by my opinion that Teach yourself c++ in 21 days is far more suited to someone just beginning C++ programming and that the book by Bjarne Stroustrup should be avoided by beginners, unless they have a very strong programming background and experience of other OO languages.


Last edited on
I apologize for my rude outburst.
You have syntax error on both lines; line number 7 & line number 9
You should write it like this and your code will compile successfully
cout << "\n"; //notice the <<

Good Luck, Zaki
I also apologise, as I agree that my initial response could have been better worded but I assure you that no offense was meant.
Perhaps, but really, I was totally out of line.

I personally don't much care for SAM's Learn X in N days books, but they are at least passable, if not old. That is my opinion though, and I should represent it as such.
It is a subjective issue and just a matter of opinion at the end of the day.

If it is any consolation I agree that it is not the best book for learning C++ but I think it is decent and is easy enough to follow when you are just starting out.

Anyway I am glad there are no ill feelings and probably best if we both move on and forget it. :)
Topic archived. No new replies allowed.