Tuesday, 13 April 2021

Structure in C and C++ - 2

 #include<stdio.h>

#include<iostream.h>

#include<conio.h>

struct Book

{

char code;

int pages;

float price;

void show();

}b1,b2;

struct Book b3;

Book b6;

main()

{

clrscr();

struct Book b4;

Book b5;

b1.code='A';

b1.pages=400;

b1.price=150;

b2.code='B';

b3.code='C';

b4.code='D';

b5.code='E';

printf("%c  %d  %f",b1.code,b1.pages,b1.price);

cout<<endl<<b2.code<<b3.code<<b4.code<<b5.code;

getch();

}

No comments:

Post a Comment