Posted By: Miroslav |
5/30/2006 12:11:00 AM |
|
|
HELP ME PLEASE with this fundamental question... In the simple program bellow why the title of the second book do not work ??? Did I do something wrong ? Thank you in advance for your help. Miroslav.
======================================================
#include
#include
#include
struct books
{
char title [50];
char author [20];
float price;
};
main ()
{
struct books book1;
struct books book2;
printf("\nType the title of the first book: ");
gets(book1.title);
printf("\nType the author of the first book: ");
gets(book1.author);
printf("\nType price of the first book: ");
scanf("%f", &book1.price);
printf("\nType the title of the second book: ");
gets(book2.title);
printf("\nType the author of the second book: ");
gets(book2.author);
printf("\nType price of the second book: ");
scanf("%f", &book2.price);
printf("\nThe title of the first book is: %s \n", book1.title);
printf("\nThe author of the first book is: %s \n", book1.author);
printf("\nThe price of the first book is: %1.2f \n", book1.price);
printf("\nThe title of the second book is: %s \n", book2.title);
printf("\nThe author of the second book is: %s \n", book2.author);
printf("\nThe price of the second book is: %1.2f \n", book2.price);
getche();
}
|
|