Welcome fellow students, register yourself and dive into asking questions, giving answers and helping the community learn with you.

C Programming: Absolute Beginner's Guide

+2 votes
asked Jan 10, 2015 in CS50 by jasonkgreen (250 points)

This book was one of the recommended reading. Is anyone else using it?

As I read the chapters I am typing the example programs into the edit appliance, compiling and then running them. Working on Chapter 9 Example 2 (page 76) I ran into two problems. The following lines are exactly what is shown in the book.

scanf(" $%f", &tirePrice);

printf("%You spent $%.2f on your tires\n\n\n", netSales);

The dollar sign ($) in the scanf line and the first percent sign (%) in the printf line each caused an error. When I removed them from their respective lines, the program compiled and run just fine. I wan't sure if this was a problem due to the fact that I am using the appliance and the book authors use Code Blocks or if it's simply a typo in the book. Thoughts?

2 Answers

+2 votes
answered Jan 10, 2015 by JohnHilton (1,570 points)
I recall a post on this topic from last year, where the consensus was that there were some errors in that book. ie. Some of the programs would not run and some would not compile.

Trusting that this is of some help.
+3 votes
answered Jan 10, 2015 by cs50xhelpers (2,800 points)
This is the errata which the official website of the book gives for a couple or one of the corrections in the book. You may check that out, if that helps.

http://www.quepublishing.com/content/images/9780789751980/errata/9780789751980Errata08_05_14.doc
Welcome to CS50xHelpers Q&A, where you can ask questions and receive answers from other members of the community.

187 questions

248 answers

217 comments

3,056 users

2 Online
0 Member And 2 Guest
...