1. Explain in your own words what each of the following does: a. b. 2. Write a a
ID: 640294 • Letter: 1
Question
1. Explain in your own words what each of the following does: a. b. 2. Write a a. b. c. cin.get cin.ignore short program that asks the user for their first name and last name finds the length of their name assigns the above value to a function that prints a line of stars to the console above their name and below their name See Program 3-25 3. C-strings: copy program 3-26 into your editor, compile and run it. Next, deliberately shorten the size of the name so that you create an overflow. What happens? 4. C-strings: copy program 3-30 into your editor, compile and run it. Next, deliberately shorten the size of the sentence or write a super long sentence in the cin. What happens? 5. Work checkpoint 3.30 and 3.31 on page 136
Explanation / Answer
#include<stdio.h>
void main(void)
{
char str1[25];
int len=0;
printf(" Enter String whose length is to be found:");
gets(str1);
while(str1[len]!='')
len++; //here the length of string is calculated.
printf(" Lengt of the String %s is %d",str1,len);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.