Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
FunPointBreakfast
//gcc 7.4.0 //FunPointBreakfast //this code is created by Rezaul Hoque on March 30,2022;contact: jewelmrh@yahoo.com,Dhaka, Bangladesh //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; #include <stdio.h> #include <stdlib.h> #include <string.h> struct menu{ char detail[80]; }m; struct menu setmenu(); struct menu pack1(); struct menu pack2(); struct menu pack3(); struct menu setmenu(){ strcpy(m.detail, "Default package has 2 parathas, 1 scrambled egg and 1 chai. It costs Tk 50.\n"); return m; } struct menu pack1(){ strcpy(m.detail,"Package 1 has 2 rotis, 1 dal and 1 coffee. It costs Tk 80.\n"); return m; } struct menu pack2(){ strcpy(m.detail,"Package 2 has 3 slices of bread, jelly, banana and chai. It costs Tk 40.\n"); return m; } struct menu pack3(){ strcpy(m.detail, "Package 3 has 1 plate of khichri.It costs Tk 60.\n"); return m; } int main() { struct menu a; struct menu (*p[4])(); p[0]=setmenu; p[1]=pack1; p[2]=pack2; p[3]=pack3; int b; printf("Select:\n"); printf(" (0)Default (1)Pack1 (2)Pack2 (3)Pack3 \n"); scanf("%d",&b); switch(b){ case 0: printf("Default package: \n"); break; case 1: printf("Package1: \n"); break; case 2: printf("Package2: \n"); break; case 3: printf("Package3: \n"); break; } a =(*p[b])(); printf("%s",a.detail); return 0; }
run
|
edit
|
history
|
help
0
Multiple if statement v0.8
Lab6 v0.5 Sin,cos,tan,cot
A_141128_MatricesSuma
Memory leak
prime or not
lab pro v.05
c program for hollow rhombus
ALPAHABET PATTERNS
C_141127_MatrizProducto
Rotación matriz anti horaria