/* File Name : Hello2.c Course Number : ISYS 290 04 Student Name : Jason Gradziel Student Number : 826-135-535 Professors Name : Brian Perry Class Name : Lab Title : */ #include #include int clrscr(void); int pause(void); int temps(char temp[81]); int title(void); int getname(char name[21], char temp[81]); int print(char name[21], int age); int getage(int age, char temp[81]); int main(void) { char temp[81] = {"\0"}; char name[21] = {"\0"}; int age; clrscr(); title(); getname(name,temp); age = getage(age,temp); print(name, age); pause(); return 0; } /* Clear Screen */ int clrscr(void) { int x; for (x=0; x<24; x++) printf("\n"); return 0; } /* Pause until enter is hit */ int pause(void) { int c; printf("\nPress enter to continue...\n"); fflush(stdin); while ((c = getchar()) != '\n') printf("%c", c); return 0; } /* Temp for input */ int temps(char temp[81]) { int x; for (x=0; x<80; x++) temp[x] = '\0'; gets(temp); return 0; } int title(void) { int x; printf("\n\n\t\t\tHello World Program"); for (x=0; x<19; x++) printf("\n"); return 0; } int getname(char name[21], char temp[81]) { int x; printf("\nWhat is your name ?\n"); temps(temp); for (x=0; x<20; x++) { name[x] = temp[x]; } return 0; } int print(char name[21], int age) { printf("\nHello %s", name); printf("\nAge : %d\n", age); return 0; } int getage(int age, char temp[81]) { int flag=1; while (flag==1) { printf("\nWhat is your age ?\n"); temps(temp); age = atoi(temp); if (age>=1 && age<=120) { flag=0; } else { printf("\nIncorrect. Try again."); pause(); } } return age; }