Answer to Question #209455 in C for Pragadeesh

Question #209455

Write a C program to display the Product information and Payment mode of a customer using bit fields.


* The product information are P_rice=0, P_wheat=1, P_dall=2, P_sugar=3, Cash=5 and Card=6


* The bit fields member functions are Ptype, Pmode and *Pname is character type


1
Expert's answer
2021-06-22T07:24:19-0400
#include<stdio.h>
#include <string.h>
struct Product{
	
	unsigned int P_rice;
	unsigned int  P_wheat ;
	unsigned int  P_dall;
	unsigned int  P_sugar;
	unsigned int  Cash;
	unsigned int  Card;
//unsigned int product_information[7];
 
};
void Ptype(){


struct Product c = { 0, 1, 2, 3, 5 ,6};
c.P_rice = 0;
printf("P_rice%d=\t", c.P_rice);
printf("\nP_wheat= %d\t",c.P_wheat);	
printf("\nP_dall= %d\t",c.P_dall);
printf("\nP_sugar =%d\t",c.P_sugar);
printf("\nP_wheat= %d\t",c.P_wheat);
	
	
}
void  Pmode(){
struct Product c = { 0, 1, 2, 3, 5 ,6};
printf("\nP_sugar =%d\t",c.P_cash);
printf("\nP_wheat= %d\t",c.P_card);


	
}
char *Pname(int n){
	
	
}


int main(){
	struct Product c;
	Ptype();
	
  
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS