01.11.2014 Views

Lesson 1.1: Hello, world

Lesson 1.1: Hello, world

Lesson 1.1: Hello, world

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Lesson</strong> 1.9:<br />

Character arrays (1/2)<br />

Programming in C<br />

Prof. Dr. Eike Best<br />

Dr. Elke Wilkeit<br />

September 28, 2002<br />

1 while ( there is another line )<br />

2 if ( it is longer than the previous longest )<br />

3 save it ;<br />

4 save its length ;<br />

5 print longest line<br />

Exercise 1-16. (Error-tolerant longest-line program) Revise the main routine<br />

of the longest-line program so it will correctly print the length of arbitrarily<br />

long lines, and as much as possible of the text.<br />

Exercise 1-17. (Printing lines longer than 80 characters)<br />

to print all input lines that are longer than 80 characters.<br />

Write a program<br />

Exercise 1-18. (Removing trailing invisibles) Write a program to remove<br />

trailing blanks and tabs from each line of input, and to delete entirely blank lines.<br />

Exercise 1-19. (Reversing strings) Write a function reverse(s) that reverses<br />

the character string s. Use it to write a program that reverses its input a line at a<br />

time.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!