#include /*the maximum amount of entries*/ #define MAXSITES 4 /*our structure*/ struct website{ char url[60]; char description[60]; int rating; }; int main() { /*site is a variable of the structure website*/ struct website site[MAXSITES]; int count = 0; int index; /*get the url*/ printf("Enter the url of the website and press enter,\n"); /*get the description*/ while(count < MAXSITES && gets(site[count].url) != NULL && site[count].description != '\0') { printf("Now enter the description of the website.\n"); gets(site[count].description); /*get the rating*/ printf("Now enter the rating out of 10.\n"); scanf("%d",&site[count++].rating); while(getchar() != '\n') continue; if(count < MAXSITES) printf("Enter the next url.\n"); } /*display the entered info*/ for(index = 0;index < count ;index++) { printf("%s\n",site[index].url); printf("%s\n",site[index].description ); printf("Is rated at %d out of 10\n",site[index].rating ); } return 0; }