Learn How to Program in C

by
Dr. Kristin Switala

Introduction

Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions

Structures


Site Map

Projects: Strings (c)

Instructions: Create a C program that runs successfully for each project below.


Project 1

Initialize a string variable with the value "John Keay".
Initialize an empty string to hold the viewer's answer.
Ask the viewer "Who wrote The Great Arc, about the mapping of India?"
Use stricmp to compare the two variables. If the result is 0, then print "Yes, it's a wonderful book." Or else print "No, John Keay wrote The Great Arc."


Project 2

Initialize two string variables:

  1. "George Everest"
  2. " became Lambton's assistant in 1818."

Concatenate these strings and print.


Project 3

Initialize two string variables:

  1. "The southern tip of India is called Cape Comorin."
  2. "Comorin"

Use strstr to determine whether Comorin is in India.

Copyright
© 2001
Kristin Switala
Hosted by www.Geocities.ws

1