Programming tutorials online .NET, Java, C++, Visual Basic, and More
 

Home
.NET Tutorials
General Programming Tutorials
Community/Forums
Site Extras

 

C/C++ Forum
 

Open forum for posting questions or comments regarding C/C++.


VIEW REPLIES | POST REPLY
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();
}



REPLY PREVIEW POSTED BY WHEN
Hi, I've tested your code and found that there was no p... lngaurav 6/10/2006 6:11:00 PM


 
Sign In
Email
Password
  Forgot my password

Search

Featured Book

Introducing Microsoft .Net, Third Edition ($19.79)
Introducing Microsoft .Net, Third Edition


Featured Software

Microsoft Visual Studio Standard 2005 ($249.99)
Microsoft Visual Studio Standard 2005