Name:________________________Netid:_______________Section:_______
__________1 4_____ ______________________
_________12____________________________________________
_____________-6________________________________________
}
_______6 1
15______________________________________________
Complete the following program that prompts a user for her
first name and then reads the name and responds with a
personal greeting.
For example:
Enter your first name: Sue
Hello Sue !
#include <stdio.h>
#include <string.h>
void main(void)
{
char fname[72];
char greeting[132];
printf("Enter your first
name: ");
scanf("%s",
____fname____________________________);
strcpy(greeting , "Hello
");
strcat(greeting , fname);
strcat(greeting , " !");
printf(" %s \n",
greeting);
}
12.100000 2.100000 _______________________________
Circle the correct Answer
a. int addTen(int x[ ]); b. int addTen(int y); c. int AddTen( int); d. void plus_ten( int);
_GreenDay
BIL
B
GreenDay
To see how variables are modified in by functions in c, write the output when the following program executes.
#include <stdio.h>
void dosumpin(int a, double b[]); /* prototype */
int didsumpin(int d, double e[]); /* prototype */
void main(void)
{
int a = 1;
int c;
double b[2] = {2.0,1.0};
dosumpin(a,b);
printf("a = %i b[0] = %lf b[1] = %lf\n",a, b[0], b[1]);
dosumpin(a,b);
printf("a = %i b[0] = %lf b[1] = %lf\n",a, b[0], b[1]);
b[0] = 2.0;
b[1] = 1.0;
c = didsumpin(a,b);
printf("a = %i b[0] = %lf b[1] = %lf c = %i\n",a , b[0], b[1], c);
}
/* Note dosumpin assigns a value to the integer (a) (a = 8;), but the value of (a) in main is unmodified. However the changes to the array (b) are carried through to main*/
void dosumpin(int a, double b[])
{
b[0] = b[0] + a;
b[1] = b[1] + a;
a = 8;
}
int didsumpin(int d, double e[])
{
e[0] = e[0] + d;
e[1] = e[1] + d;
a = 1 b[0] = 3.000000 b[1] = 2.000000
a = 1 b[0] = 4.000000 b[1] = 3.000000
a = 1 b[0] = 3.000000 b[1] = 2.000000 c = 2
_________________
How many times does the word 'the'
appear? (Exact Match)
_________3__________
How many occurrence of 'the' are there?
(Partial Match)
____________4_______
What is the average length of the words
in the file illini.txt ?
_______4.92____________