Advertisement
asiffff

p-f1

Apr 2nd, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.90 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <windows.h>
  5. #include <conio.h>
  6. struct student
  7. {
  8. int id;
  9. int cla;
  10. long int p_num;
  11. char group[20];
  12. char name[20];
  13. char name1[20];
  14. char gender[20];
  15. double bangla,english,math,physics,chemistry,biology;
  16. struct student *next,*prev;
  17. }*start=NULL,*end=NULL,*current;
  18.  
  19. void create()
  20. {
  21. char na[20];
  22. if(start==NULL && end==NULL)
  23. {
  24. struct student *new_node;
  25. new_node=(struct student*)malloc(1*sizeof(struct student));
  26. printf("Enter First Name: ");
  27. scanf("%s",&new_node->name);
  28. printf("\nEnter Last Name: ");
  29. scanf("%s",&new_node->name1);
  30. printf("\nEnter Gender: ");
  31. scanf("%s",&new_node->gender);
  32. printf("\nEnter Class: ");
  33. scanf("%d",&new_node->cla);
  34. printf("\nEnter ID: ");
  35. scanf("%d",&new_node->id);
  36. printf("\nEnter Group: ");
  37. scanf("%s",&new_node->group);
  38. printf("\nEnter Parents Phone Number: ");
  39. scanf("%ld",&new_node->p_num);
  40. new_node->next=NULL;
  41. new_node->prev=NULL;
  42. start=new_node;
  43. end=new_node;
  44. current=new_node;
  45. system("cls");
  46. }
  47. else
  48. {
  49. struct student *new_node;
  50. new_node=(struct student*)malloc(1*sizeof(struct student));
  51. printf("Enter First Name: ");
  52. scanf("%s",&new_node->name);
  53. printf("\nEnter Last Name: ");
  54. scanf("%s",&new_node->name1);
  55. printf("\nEnter Gender: ");
  56. scanf("%s",&new_node->gender);
  57. printf("\nEnter Class: ");
  58. scanf("%d",&new_node->cla);
  59. printf("\nEnter ID: ");
  60. scanf("%d",&new_node->id);
  61. printf("\nEnter Group: ");
  62. scanf("%s",&new_node->group);
  63. printf("\nEnter Parents Phone Number: ");
  64. scanf("%ld",&new_node->p_num);
  65. new_node->next=NULL;
  66. new_node->prev=NULL;
  67. current->next=new_node;
  68. new_node->prev=current;
  69. end=new_node;
  70. current=new_node;
  71. system("cls");
  72. }
  73. }
  74. void dis(int a)
  75. {
  76. int n=0,i=1;
  77. struct student *c;
  78. c=start;
  79. while(c!=NULL)
  80. {
  81. if(c->cla==a)
  82. {
  83. printf("%d. Name : %s %s Gender : %s\nClass : %d ID : %d\nGroup : %s Parents Phone Number: %ld\n",i,c->name,c->name1,c->gender,c->cla,c->id,c->group,c->p_num);
  84.  
  85. n++;
  86. }
  87. c=c->next;
  88. }
  89. //return n;
  90. if(n==0)
  91. printf("There is no student in this Class\n");
  92. else
  93. printf("Total Student %d",n);
  94. }
  95.  
  96. struct teacher
  97. {
  98. int id;
  99. char name[20];
  100. char name1[20];
  101. char gender[20];
  102. char group[20];
  103. long int phnum;
  104. struct teacher *next,*prev;
  105.  
  106. }*start1=NULL,*end1=NULL,*current1;
  107. void create1()
  108. {
  109. struct teacher *new_node;
  110. if(start1==NULL && end1==NULL)
  111. {
  112. new_node=(struct teacher*)malloc(1*sizeof(struct teacher));
  113. printf("Enter First Name: ");
  114. scanf("%s",&new_node->name);
  115. printf("\nEnter Last Name: ");
  116. scanf("%s",&new_node->name1);
  117. printf("\nEnter ID: ");
  118. scanf("%d",&new_node->id);
  119. printf("\nEnter Group: ");
  120. scanf("%s",&new_node->group);
  121. printf("\nEnter Gender: ");
  122. scanf("%s",&new_node->gender);
  123. printf("\nEnter Phone Number: ");
  124. scanf("%ld",&new_node->phnum);
  125. new_node->next=NULL;
  126. new_node->prev=NULL;
  127.  
  128. start1=new_node;
  129. end1=new_node;
  130. current1=new_node;
  131. system("cls");
  132.  
  133. }
  134. else
  135. {
  136. new_node=(struct teacher*)malloc(1*sizeof(struct teacher));
  137. printf("Enter First Name: ");
  138. scanf("%s",&new_node->name);
  139. printf("\nEnter Last Name: ");
  140. scanf("%s",&new_node->name1);
  141. printf("\nEnter ID: ");
  142. scanf("%d",&new_node->id);
  143. printf("\nEnter Group: ");
  144. scanf("%s",&new_node->group);
  145. printf("\nEnter Gender: ");
  146. scanf("%s",&new_node->gender);
  147. printf("\nEnter Phone Number: ");
  148. scanf("%ld",&new_node->phnum);
  149. new_node->next=NULL;
  150. new_node->prev=NULL;
  151.  
  152. current1->next=new_node;
  153. new_node->prev=current1;
  154. current1=new_node;
  155. end1=new_node;
  156. system("cls");
  157. }
  158.  
  159.  
  160.  
  161. }
  162. void dis1()
  163. {
  164. struct teacher *c;
  165. c=start1;
  166. while(c!=NULL)
  167. {
  168. printf("Teacher ID:%d\n",c->id);
  169. printf("Your group:%s\n",c->group);
  170. printf("Teacher Name:%s %s\n",c->name,c->name1);
  171. printf("Teacher Gender:%s\n",c->gender);
  172. printf("Teacher Phone number:%ld\n",c->phnum);
  173. c=c->next;
  174. }
  175. }
  176. int search(int a,int y)
  177. {
  178. struct student *c;
  179. struct teacher *c1;
  180. int po=0;
  181. if(a!=0 && y!=0)
  182. {
  183. c=start;
  184. while(c!=NULL)
  185. {
  186. po++;
  187. if(c->cla==a && c->id)
  188. {
  189. return po;
  190. }
  191. c=c->next;
  192. }
  193. return -1;
  194. }
  195. else
  196. {
  197. c1=start1;
  198. while(c1!=NULL)
  199. {
  200. po++;
  201. if(c1->id==a)
  202. {
  203. return po;
  204. }
  205. c1=c1->next;
  206. }
  207. return -1;
  208.  
  209. }
  210. }
  211. void print1()
  212. {
  213. printf("\n\n\n");
  214. printf("\t\t\t1.Enter Student Details.\n");
  215. printf("\t\t\t2.View All Student Details\n");
  216. printf("\t\t\t3.Search Student Details.\n");
  217. printf("\t\t\t4.Enter Teacher Details.\n");
  218. printf("\t\t\t5.View All Teacher Details\n");
  219. printf("\t\t\t6.Search Teacher Details.\n");
  220. printf("\t\t\t7.Enter Student Results\n");
  221. printf("\t\t\t8.View Student Result\n");
  222. printf("\t\t\tExit.\n");
  223. }
  224.  
  225. void print()
  226. {
  227. int i;
  228. printf(" ");
  229. for(i=1; i<=59; i++)
  230. {
  231. printf("* ");
  232. }
  233. printf("\n\n");
  234. printf("\t\t\t\t DAFFODIL INTERNATIONAL SCHOOL\n\n");
  235. printf(" ");
  236. for(i=1; i<=59; i++)
  237. {
  238. printf("* ");
  239. }
  240. printf("\n");
  241. }
  242.  
  243. int main()
  244. {
  245. int x,y,ex=0,d=0;
  246. char c[10],p[10];
  247. while(1)
  248. {
  249.  
  250. system("cls");
  251. print();
  252. if(d==1)
  253. {
  254. system("cls");
  255. print();
  256. printf("\t\t\tWrong Password! Try again.");
  257. }
  258. printf("\n\n\n");
  259. printf("\t\t\t\tEnter User Name: ");
  260. scanf("%s",c);
  261. printf("\n");
  262. printf("\t\t\t\tEnter Password: ");
  263. scanf("%s",&p);
  264. if(strcmp(c,"techy5")==0 && strcmp(p,"121172")==0)
  265. {
  266. system("cls");
  267. print();
  268. printf("\t\t\tWelcome To Daffodil International School.\n\n\n");
  269. printf("\t\t\tPress any key to enter in the Admin Panel\n");
  270. getch();
  271. system("cls");
  272. break;
  273. }
  274. else
  275. {
  276. system("cls");
  277. d=1;
  278. //printf("Wrong Password! Try again.\n");
  279. continue;
  280. }
  281. }
  282.  
  283. while(1)
  284. {
  285.  
  286. if(ex==1)
  287. {
  288. system("cls");
  289. printf("\t\t\t\tThank You.\n");
  290. printf("By : Techy5\n");
  291. getch();
  292. system("cls");
  293. break;
  294. }
  295.  
  296. print();
  297. print1();
  298. scanf("%d",&x);
  299. switch(x)
  300. {
  301. case 1:
  302. {
  303. while(1)
  304. {
  305. system("cls");
  306. print();
  307. create();
  308. print();
  309. printf("\t\tDo you want to continue?\n");
  310. printf("1.Yes 2.No\n");
  311. int e;
  312. scanf("%d",&e);
  313. if(e==1)
  314. continue;
  315. else
  316. break;
  317. }
  318. system("cls");
  319. break;
  320. }
  321. case 2:
  322. {
  323. system("cls");
  324. print();
  325. printf("\t\t\t\t1.Class 6\n\t\t\t\t2.Class 7.\n\t\t\t\t3.Class 8.\n\t\t\t\t4.Class 9.\n\t\t\t\t5.Class 10.\n");
  326. int e;
  327. scanf("%d",&e);
  328. system("cls");
  329. switch(e)
  330. {
  331. case 1:
  332. {
  333. system("cls");
  334. print();
  335. dis(6);
  336. getch();
  337. system("cls");
  338. break;
  339. }
  340. case 2:
  341. {
  342. system("cls");
  343. print();
  344. dis(7);
  345. getch();
  346. system("cls");
  347. break;
  348. }
  349. case 3:
  350. {
  351. system("cls");
  352. print();
  353. dis(8);
  354. getch();
  355. break;
  356. }
  357. case 4:
  358. {
  359. system("cls");
  360. print();
  361. dis(9);
  362. getch();
  363. break;
  364. }
  365. case 5:
  366. {
  367. system("cls");
  368. print();
  369. dis(10);
  370. getch();
  371. break;
  372. }
  373. }
  374. //dis();
  375. print();
  376. printf("\n\n\nPress any key to quit.");
  377. getch();
  378. system("cls");
  379. break;
  380. }
  381. case 3:
  382. {
  383. while(1)
  384. {
  385. system("cls");
  386. print();
  387. int x1,y1;
  388. printf("\n\n\nEnter Class: ");
  389. scanf("%d",&x1);
  390. printf("\nEnter Student ID: ");
  391. scanf("%d",&y1);
  392. system("cls");
  393. //print();
  394. int pos = search(x1,y1);
  395. if(pos==-1)
  396. {
  397. print();
  398. printf("\n\n\nNot Found");
  399. getch();
  400. system("cls");
  401. }
  402. else
  403. {
  404. print();
  405. struct student *b;
  406. b=start;
  407. int j;
  408. for(j=0; j<pos-1; j++)
  409. {
  410. b=b->next;
  411. }
  412. printf("\n\n\nName : %s %s\nGender : %s\nClass : %d\nID : %d\nGroup : %s\nParents Number : %ld\n",b->name,b->name1,b->gender,b->cla,b->id,b->group,b->p_num);
  413. printf("\n\nPress any key.");
  414. getch();
  415. system("cls");
  416. }
  417. print();
  418. printf("\n\n\nDo you want to search another?\n 1.Yes 2.No\n");
  419. int e;
  420. scanf("%d",&e);
  421. if(e==1)
  422. continue;
  423. else if(e==2)
  424. break;
  425.  
  426. }
  427. system("cls");
  428. break;
  429. }
  430. case 4:
  431. {
  432. while(1)
  433. {
  434. system("cls");
  435. print();
  436. create1();
  437. int e;
  438. print();
  439. printf("\n\n\nDo you want to Continue?\n1.Yes 2.No\n");
  440. scanf("%d",&e);
  441. if(e==1)
  442. continue;
  443. else if(e==2)
  444. break;
  445. }
  446. system("cls");
  447. break;
  448. }
  449. case 5:
  450. {
  451. system("cls");
  452. print();
  453. dis1();
  454. getch();
  455. system("cls");
  456. break;
  457. }
  458. case 6:
  459. {
  460. while(1)
  461. {
  462. system("cls");
  463. print();
  464. printf("\n\n\nEnter Id:\n");
  465. int k;
  466. scanf("%d",&k);
  467. int pos1 = search(k,0);
  468. if(pos1==-1)
  469. {
  470. system("cls");
  471. print();
  472. printf("\n\n\nNot Found\n");
  473. getch();
  474. system("cls");
  475. }
  476. else
  477. {
  478. system("cls");
  479. print();
  480. struct teacher *c;
  481. c=start1;
  482. int j;
  483. for(j=0; j<pos1-1; j++)
  484. {
  485. c=c->next;
  486. }
  487. printf("\n\n\nTeacher Name :%s\n",c->name);
  488. printf("\nTeacher ID :%d",c->id);
  489. printf("\nGroup :%s",c->group);
  490. printf("\nTeacher Gender :%s",c->gender);
  491. printf("\nPhone number :%ld",c->phnum);
  492. getch();
  493. system("cls");
  494.  
  495. }
  496. print();
  497. printf("\n\n\nDo you want to continue?\n1.Yes 2.No\n");
  498. int e;
  499. scanf("%d",&e);
  500. if(e==1)
  501. continue;
  502. else
  503. break;
  504. }
  505. system("cls");
  506. break;
  507. }
  508. case 7:
  509. {
  510. while(1)
  511. {
  512. system("cls");
  513. print();
  514. int x1,y1;
  515. printf("\n\n\nEnter Class: ");
  516. scanf("%d",&x1);
  517. printf("\nEnter Student ID: ");
  518. scanf("%d",&y1);
  519. system("cls");
  520. int k;
  521. //y=2;
  522. int pos1 = search(x1,y1);
  523. if(pos1==-1)
  524. {
  525. system("cls");
  526. print();
  527. printf("\n\n\nNot Found\n");
  528. getch();
  529.  
  530. }
  531. else
  532. {
  533. print();
  534. struct student *c;
  535. c=start;
  536. int j;
  537. for(j=0; j<pos1-1; j++)
  538. {
  539. c=c->next;
  540. }
  541. printf("\n\n\nName : %s %s\n",c->name,c->name1);
  542. printf("Bangla : ");
  543. scanf("%lf",&c->bangla);
  544. printf("\nEnglish: ");
  545. scanf("%lf",&c->english);
  546. printf("\nMath: ");
  547. scanf("%lf",&c->math);
  548. printf("\nPhysics: ");
  549. scanf("%lf",&c->physics);
  550. printf("\nChemistry: ");
  551. scanf("%lf",&c->chemistry);
  552. printf("\nBiology: ");
  553. scanf("%lf",&c->biology);
  554. //getch();
  555. system("cls");
  556. }
  557. int e;
  558. print();
  559. printf("\n\nDo you want to continue?\n1.Yes 2.No\n");
  560. scanf("%d",&e);
  561. if(e==1)
  562. continue;
  563. else
  564. break;
  565.  
  566. }
  567. system("cls");
  568. break;
  569. }
  570. case 8:
  571. {
  572. while(1)
  573. {
  574. system("cls");
  575. print();
  576. int x1,y1;
  577. printf("\n\nEnter Class: ");
  578. scanf("%d",&x1);
  579. printf("\nEnter Student ID: ");
  580. scanf("%d",&y1);
  581. system("cls");
  582. int k;
  583. int pos1 = search(x1,y1);
  584. if(pos1==-1)
  585. {
  586. printf("Not Found\n");
  587. getch();
  588. system("cls");
  589. }
  590. else
  591. {
  592. system("cls");
  593. struct student *c;
  594. c=start;
  595. int j;
  596. for(j=0; j<pos1-1; j++)
  597. {
  598. c=c->next;
  599. }
  600. print();
  601.  
  602. printf("\n\nName : %s %s Group: %s\nClass : %d Roll : %d\n",c->name,c->name1,c->group,c->cla,c->id);
  603. printf("Bangla : %.2lf\n",c->bangla);
  604. printf("\nEnglish: %.2lf\n",c->english);
  605.  
  606. printf("\nMath: %.2lf\n",c->math);
  607.  
  608. printf("\nPhysics: %.2lf\n",c->physics);
  609.  
  610. printf("\nChemistry: %.2lf\n",c->chemistry);
  611.  
  612. printf("\nBiology: %.2lf\n",c->biology);
  613.  
  614. getch();
  615. system("cls");
  616.  
  617. }
  618. int e;
  619. print();
  620. printf("Do you want to continue?\n1.Yes 2.No\n");
  621. scanf("%d",&e);
  622. if(e==1)
  623. continue;
  624. else if(e==2)
  625. break;
  626. }
  627. system("cls");
  628. break;
  629.  
  630.  
  631. }
  632. case 9:
  633. {
  634. ex = 1;
  635. break;
  636. }
  637.  
  638. }
  639. }
  640. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement