#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void checkGPA(float);
float userGPA;
int main() {
char szState[15];
char szfName[15];
char szlName[20];
char szSpouse[15];
char cMarried;
int iAge, iCount;
printf("Hello, my name is Lerie. What is your name? ");
gets(szfName);
szfName[0] = toupper(szfName[0]);
if(strlen(szfName) > 8)
{
printf("wow, thats a long name!");
}
else
{
printf("at least your name isnt real long\n\n");
}
printf("OK %s what is your last name? ", szfName);
gets(szlName);
szfName[0] = toupper(szfName[0]);
if(strlen(szlName) > 7)
{
printf("Last name is longer than mine!\n\n");
}
else
{
printf("not much to type for that name.\n\n");
}
szlName[0] = toupper(szlName[0]);
/* for(iCount = 1; iCount < (int) strlen(szlName); iCount++)
{
if(szlName[iCount - 1 ] = ' ')
szlName[iCount] = toupper(szlName[iCount]);
else
szlName[iCount] = tolower(szlName[iCount]);
}*/
printf("How old are you %s? ", szfName);
scanf("%d", &iAge);
fflush(stdin);
if(iAge < 18)
{
printf("Your still a minor.\n\n");
}//end if
else
{
if(iAge >= 21)
{
printf("At least you can buy beer.\n\n");
}//end if
else
{
if(iAge >= 30)
{
printf("Your thirties should be a good time.\n\n");
}//end if
else
{
if(iAge >= 50)
{
printf("About over the hill, yea?\n\n");
}//end if
}//end else
}//end else
}//end else
printf("What state do you reside in, %s? ", szfName);
gets(szState);
szState[0] = toupper(szState[0]);
for(iCount = 1; iCount < (int) strlen(szState); iCount++)
{
if(szState[iCount -1] == ' ')
szState[iCount] = toupper(szState[iCount]);
else
szState[iCount] = tolower(szState[iCount]);
}
printf("%s is a nice place, I think i've been there before\n\n", szState);
printf("What is your GPA %s? ", szfName);
scanf("%f", &userGPA);
fflush(stdin);
checkGPA(userGPA);
printf("Are you married? ");
scanf("%c", &cMarried);
fflush(stdin);
if(cMarried == 'y')
{
printf("What is your spouse's name? ");
gets(szSpouse);
szSpouse[0] = toupper(szSpouse[0]);
printf("%s is a nice name\n\n", szSpouse);
}
else
{
printf("It's never to late!\n\n");
}
printf("------------------------------------------\n");
printf("Your name is %s %s.\n", szfName, szlName);
if(cMarried == 'y')
{
printf("You are married, your spouses name is %s.\n", szSpouse);
}
else
{
printf("You are not married.\n");
}
printf("You are %d years old.\n", iAge);
printf("You live in %s\n",szState);
printf("------------------------------------------\n");
return 0;
}
void checkGPA(float userGPA)
{
if(userGPA > 4.0f)
{
printf("Wow, you're mom must be proud\n");
}
else
{//end if
if(userGPA == 4.0f)
{
printf("Excellent, a straight A student!\n\n");
}
else
{//end if
if(userGPA >= 3.0f)
{
printf("Almost a straight A student\n\n");
}
else
{//end if
if(userGPA >= 2.0f)
{
printf("Well that doesn't look very good...\n\n");
}
else
{//end if
if(userGPA >= 1.0f)
{
printf("That is a very very poor grade point average!\n\n");
}
else
{//end if
if(userGPA >= 0.0f)
{
printf("Did you even attend a school?\n\n");
}//end if
}//end else
}//end else
}//end else
}//end else
}//end else
}