lab5 please submit the lab before you leave please include at a minimum your name, the date, and the...

5
Lab5 Please submit the lab before you leave Please include at a minimum your name, the date, and the lab-program number at the top of the program as a comment . Please also save each file as lab number and your name. Please submit the zip file of your programs 08/26/22 Lab5 1

Upload: cori-whitehead

Post on 04-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lab5 Please submit the lab before you leave Please include at a minimum your name, the date, and the lab- program number at the top of the program as a

Lab5

Please submit the lab before you leave

Please include at a minimum your name, the date, and the lab-program number at the top of the program as a comment.Please also save each file as lab number and your name.

Please submit the zip file of your programs to TA

04/20/23 Lab5 1

Page 2: Lab5 Please submit the lab before you leave Please include at a minimum your name, the date, and the lab- program number at the top of the program as a

Program I

• Create random string and store it in char array. String size is also random.

dasdSfsbfjhjgDyytSfgdfjkujgAhnvbdfhjkhHJHydtbfKJHgfd.The string size is (answer).Press any key to continue.

04/20/23 Lab5 2

Page 3: Lab5 Please submit the lab before you leave Please include at a minimum your name, the date, and the lab- program number at the top of the program as a

Program II

• Create random string and then convert all lowercase letter to uppercase.

dasdSfsbfjhjgDyytSfgdfjkDASDSFSBFJHJGDYYTSFGDFJKPress any key to continue.

04/20/23 Lab5 3

Page 4: Lab5 Please submit the lab before you leave Please include at a minimum your name, the date, and the lab- program number at the top of the program as a

Program III

• Create random string and then count how many the character user input are in the string.

dasdSfsbfjhjgDyytSfgdfjkPlease input a letter: jThere are 3 ‘j’s in the string.Do you want to check more?(y/n): yPlease input a letter: SThere are 2 ‘S’s in the string.Do you want to check more?(y/n): nPress any key to continue.

04/20/23 Lab5 4

Page 5: Lab5 Please submit the lab before you leave Please include at a minimum your name, the date, and the lab- program number at the top of the program as a

(Option) Program IV

• Declare char array and initialize with the sentence, “I am a boy. You are a girl.” (not using scanf) Now the program check if the word user input is in the sentence.

“I am a boy. You are a girl.”Please input a word: boy(enter)Yes, there is “boy” in the sentence.Do you want to check more(y/n)?yPlease input a word: Girl(enter)No, there is no “Girl” in the sentence.Do you want to check more(y/n)?nPress any key to continue.

04/20/23 Lab5 5