hw7 - Write a C program called printToken() , which will...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 7 (4-11) 4. (Ch. 11, Problem 2) Write a program that reads the three strings suzy , “suzy” , and 'suzy' . Are the single and double quotes ignored by C or read as part of the string? 5. (Ch. 11, Problem 5) Write a program that uses function strcmp to compare two strings input by the user. The program should state whether the first string is less than, equal to or greater than the second string.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6. (Ch. 11, Problem 7) Write a program that reads 4 strings and prints only those strings beginning with the letter “ b ”. 7. (Ch. 11, Problem 9) Write a program that inputs 4 strings that represent integers, converts the strings to integers, sums the values and prints the total of the 4 values. 8. (Ch. 11, Problem 10) Write a program that inputs 4 strings that represent floating-point values, converts the strings to double values, sums the values and prints the total of the 4 values. Input strings “2”, “10.5”, “12”, “12.5” to test your program.
Background image of page 2
9. (Ch. 11, Problem 11 a)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Write a C program called printToken() , which will print out tokens abc ABC ABCD efg 123 456 789 abc ABC from its argument as a pointer to char with delimiters of ;,;: . a.) Function printToken( ) must use standard C function strtok(). 10. (Ch. 11, Problem 13) Write a program to read a radius from the command line. The program will print out the value of the radius. The command line option -c will print out the area of the circle whereas the option -s will print out the volume of the sphere. Test your program with the command line options shown. radius.c 5 radius.c -c 5 radius.c -s 5 radius.c -c -s 5 radius.c -cs 5 11. (Ch. 11, Problem 14) Write a program that will extract Web addresses starting with a token www. and ending with .edu. The program displays Web addresses contained in the input entered by the user. Test your program with the following two lines. http://www.mit.edu <a href= http://www.ucdavis.edu > UC Davis </a>...
View Full Document

Page1 / 5

hw7 - Write a C program called printToken() , which will...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online