#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
FILE *pFile;
char buffer[1000];
char msg[200];
char msg1[200];
char firstname[20];
char professor[20];
char classroom[20];
char lastname[20];
char textbook[20];
char address[200];
char cellnumber[11]={0};
char areacode[6];
char threedigits[6];
char fourdigits[6];
char *A[4]={"Easiness:","Helpfulness:","Clarity:","Rater Interest:"};
char *tokenptr;
char *tokenptr1;
int number;
int a=0;
int b=0;
int i,answer1,answer2,answer3,answer4;
const char *s1="worst";
///////////////////////////////////////////////////////////////////
printf("\t\t\t\t*** Welcome *** \n\n \t\t*** Please enter the requested infortmation: *** \n\n");
printf("***Your information:***\n-------------------------------------------------\n\n");
printf("First Name:\t\t");
gets(firstname);
printf("\n\n");
printf("Last Name:\t\t");
gets(lastname);
printf("\n\n");
printf("Address:\t\t");
gets(address);
printf("\n\n");
printf("Cell Number:\t\t");
gets(cellnumber);
printf("\n\n");
printf("***Cellphone Information:***\n-------------------------------------------------\n\n");
tokenptr1=strtok(cellnumber, "-");
while(tokenptr1!= NULL)
{
if (b==0)
{
printf("The Area code:\t\t%s\n\n\n",tokenptr1);
b++;
tokenptr1=strtok(NULL, "-");
}
else if (b==1)
{
printf("The three digits:\t\t%s\n\n\n",tokenptr1);
b++;
tokenptr1=strtok(NULL, "-");
}
else if (b==2)
{
printf("The Last four digits:\t\t%s\n\n\n",tokenptr1);
tokenptr1=strtok(NULL, "-");
}
}
printf("***Class Information:***\n-------------------------------------------------\n\n");
printf("Professor:\t\t");
gets(professor);
printf("\n\n");
printf("Textbook Used:\t\t");
gets(textbook);
printf("\n\n");
printf("Classroom Used:\t\t");
gets(classroom);
printf("\n\n");
printf("***Comments:***\n-------------------------------------------------\n\n");
printf(" << NOTE: >> Please keep comments clean. Libelous comments will be deleted.\n\n");
gets(msg);
strcpy(msg1,msg);
printf("\n\n");
// puts(msg);
///////////////////////////////////////////// SPAM OR NOT SPAM
tokenptr=strtok(msg, " ");
while(tokenptr!= NULL)
{
number=strcmp(tokenptr,s1);
if (number==0) a++;
else a;
tokenptr=strtok(NULL, " ");
}
if ( a>0 ) {printf("This massage contains %d words which are not acceptable\n\n",a); return 0;}
else
{
printf("OK to send. NEXT STEP -> \n\n");
}
sprintf(buffer,"\n***STUDENT'S INFO:***\n\n*First Name:\t\t%s\n\n*Last Name:\t\t%s\n\n*Address:\t\t%s\n\n***CLASS INFO:***\n\n*Professor:\t\t%s\n\n*Textbook:\t\t%s\n\n*Class Room:\t\t%s\n\n*Comments:\n\n %s",firstname,lastname,address,professor,textbook,classroom,msg1);
pFile = fopen ("myfile.txt","w");
fwrite (buffer,1,strlen(buffer),pFile);
fclose (pFile);
printf("***Poll:***\n-------------------------------------------------\n\n");
printf("Please answer to the poll below by giving grades 1-5 , 5 = highest , 1 = lowest\n\n");
printf("%s\t\t",A[0]);
scanf("%d",&answer1);
printf("-------------------------------------------------\n\n");
printf("%s\t\t",A[1]);
scanf("%d",&answer2);
printf("-------------------------------------------------\n\n");
printf("%s\t\t",A[2]);
scanf("%d",&answer3);
printf("-------------------------------------------------\n\n");
printf("%s\t\t",A[3]);
scanf("%d",&answer4);
printf("-------------------------------------------------\n\n");
//////////////////////////////////////////
system("PAUSE");
return 0;
}
------- Out put: ---------------------
*** Welcome ***
*** Please enter the requested infortmation: ***
***Your information:***
-------------------------------------------------
First Name: Vaheh
Last Name: Aloianmelikpour
Address: 800 Ssss Lane
Cell Number: 650-444-6666
***Cellphone Information:***
-------------------------------------------------
The Area code: 650
The three digits: 444
The Last four digits: 6666
***Class Information:***
-------------------------------------------------
Professor: Dr. Ssssss
Textbook Used: C programming
Classroom Used: E2-501
***Comments:***
-------------------------------------------------
<< NOTE: >> Please keep comments clean. Libelous comments will be deleted.
She is really good.
OK to send. NEXT STEP ->
***Poll:***
-------------------------------------------------
Please answer to the poll below by giving grades 1-5 , 5 = highest , 1 = lowest
Easiness: 5
-------------------------------------------------
Helpfulness: 5
-------------------------------------------------
Clarity: 5
-------------------------------------------------
Rater Interest: 5
-------------------------------------------------
Press any key to continue . . .
---------------- Text file saved: ---------------------
***STUDENT'S INFO:***
*First Name: Vaheh
*Last Name: Aloianmelikpour
*Address: 800 Ssss Lane
***CLASS INFO:***
*Professor: Dr. Ssssss
*Textbook: C programming
*Class Room: E2-501
*Comments:
She is really good.