Advertisement
asiffff

Untitled

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