Monday, February 23, 2009
structure in c profram 2
#include
main(void)
{
struct computer
{float cost;
char name[15];
int b_date;
char city[10];
}nc[3];
int i;
for(i=0;i<2;i++)
{
printf("NAME:");
gets(nc[i].name);
printf("b_date::");
scanf("%d",&nc[i].b_date);
flushall();
printf("CITY:");
gets(nc[i].city);
}
for(i=0;i<=5;i++)
{
printf("\n NAME: %s",nc[i].name);
printf("\n CITY: %s",nc[i].city);
printf("\n B_DATE:YEAR %d ",nc[i].b_date);
getch();
}
return 0;
}
structures in c program 1
#include
#include
main(void)
{
struct employee
{
int id;
char name[32];
};
struct employee info={1,"niraj"};
printf("\nhere is the sample:");
printf("\nemp name: %s",info.name);
printf("\nemp id #:%04d\n\n",info.id);
printf("\nwhat is ur name?:");
gets(info.name);
printf("what is ur #id no");
scanf("%d",&info.id);
printf("\nhere is entered data:");
printf("\nemp name: %s",info.name);
printf("\nemp id #:%04d\n\n",info.id);
getch();
}
here c programming examples
here you can get c programming examples.just copy it to notepad and change the extension with .c and run with your compiler(like turbo c).
Subscribe to:
Posts (Atom)