Done with my Programming Class

It's finished.  Four weeks of misery and an overall complete waste of my time.  My teacher was constantly saying things that were factually wrong.  The only notes I ever bothered taking where things she said wrong, which was almost every day.

The final today was 8 questions.  All true/false or multiple choice.  First question:
Which function would you use to read in a line from the keyboard?
A. scanf()
B. gets()
C. getchar()
D. B & C

Correct answer: B.  This question was causing some confusion, so she got up in front of the entire class and clarified that there is in fact only one right answer.
Legitimate answers: A, B, and C.  It really depends what you want to do.  Lets say you wanted to read the words in one at a time, or a character at a time to process them.  Then you could use scanf or getchar.  It all depends on how much control you need and how much you want the library to do for you.

int i;
char string[100];
for (i=0; (string[i] = getchar()) != '\n'; i++) {
     // process each character, ie lower to upper case

There was also a question about how to read text from a file.  fscanf was the wrong answer.

Fuck. This. Shit.

Popular Posts