Presentation is loading. Please wait.

Presentation is loading. Please wait.

Robotics scanf and strings March 18 th, 2011. Today’s learning objective Use character strings Use the “scanf” function to input data into C programs.

Similar presentations


Presentation on theme: "Robotics scanf and strings March 18 th, 2011. Today’s learning objective Use character strings Use the “scanf” function to input data into C programs."— Presentation transcript:

1 Robotics scanf and strings March 18 th, 2011

2 Today’s learning objective Use character strings Use the “scanf” function to input data into C programs. Make our own madlib programs!

3 Here’s the story… It was a _________ day at PATH. Mr. Oakland was ___________ because someone had _________ the _________.

4 character strings We’ve met “int” before. This is a variable of type integer. “char” means a character. What do you suppose the last line means? int mynumber; char mycharacter; char mystring[80];

5 When the program sees a scanf statement, it will stop and wait for the user to type something, and then try to put the user's input into the variable scanf ("%s", &string1);.

6 Classwork 1 Go to www.smugboy.net Download, compile, and run “madlib.c”

7 Classwork 2 Modify the “madlib.c” program to make a different story. You might want to change the types of strings the computer asks for. For example, ask for someone’s name, or a location. When you are done, show your program to someone else and have them run it without knowing what story it will make!


Download ppt "Robotics scanf and strings March 18 th, 2011. Today’s learning objective Use character strings Use the “scanf” function to input data into C programs."

Similar presentations


Ads by Google