Advertisement
asiffff

Untitled

Apr 3rd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.25 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\t9.Exit.\n");
  223. }
  224. void cls()
  225. {
  226. system("cls");
  227. }
  228.  
  229. void print()
  230. {
  231. int i;
  232. printf(" ");
  233. for(i=1; i<=59; i++)
  234. {
  235. printf("* ");
  236. }
  237. printf("\n\n");
  238. printf("\t\t\t\t DAFFODIL INTERNATIONAL SCHOOL\n\n");
  239. printf(" ");
  240. for(i=1; i<=59; i++)
  241. {
  242. printf("* ");
  243. }
  244. printf("\n");
  245. }
  246. void xnxx()
  247. {
  248. int exit = 0;
  249. while(1)
  250. {
  251. if(exit==1)
  252. {
  253. break;
  254. }
  255. int x;
  256. cls();
  257. print();
  258. print1();
  259. scanf("%d",&x);
  260. switch(x)
  261. {
  262. case 1:
  263. {
  264. while(1)
  265. {
  266. system("cls");
  267. print();
  268. create();
  269. print();
  270. printf("\t\tDo you want to continue?\n");
  271. printf("1.Yes 2.No\n");
  272. int e;
  273. scanf("%d",&e);
  274. if(e==1)
  275. continue;
  276. else
  277. break;
  278. }
  279. system("cls");
  280. break;
  281. }
  282. case 2:
  283. {
  284. system("cls");
  285. print();
  286. 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");
  287. int e;
  288. scanf("%d",&e);
  289. system("cls");
  290. switch(e)
  291. {
  292. case 1:
  293. {
  294. system("cls");
  295. print();
  296. dis(6);
  297. getch();
  298. system("cls");
  299. break;
  300. }
  301. case 2:
  302. {
  303. system("cls");
  304. print();
  305. dis(7);
  306. getch();
  307. system("cls");
  308. break;
  309. }
  310. case 3:
  311. {
  312. system("cls");
  313. print();
  314. dis(8);
  315. getch();
  316. break;
  317. }
  318. case 4:
  319. {
  320. system("cls");
  321. print();
  322. dis(9);
  323. getch();
  324. break;
  325. }
  326. case 5:
  327. {
  328. system("cls");
  329. print();
  330. dis(10);
  331. getch();
  332. break;
  333. }
  334. }
  335. //dis();
  336. print();
  337. printf("\n\n\nPress any key to quit.");
  338. getch();
  339. system("cls");
  340. break;
  341. }
  342. case 3:
  343. {
  344. while(1)
  345. {
  346. system("cls");
  347. print();
  348. int x1,y1;
  349. printf("\n\n\nEnter Class: ");
  350. scanf("%d",&x1);
  351. printf("\nEnter Student ID: ");
  352. scanf("%d",&y1);
  353. system("cls");
  354. //print();
  355. int pos = search(x1,y1);
  356. if(pos==-1)
  357. {
  358. print();
  359. printf("\n\n\nNot Found");
  360. getch();
  361. system("cls");
  362. }
  363. else
  364. {
  365. print();
  366. struct student *b;
  367. b=start;
  368. int j;
  369. for(j=0; j<pos-1; j++)
  370. {
  371. b=b->next;
  372. }
  373. 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);
  374. printf("\n\nPress any key.");
  375. getch();
  376. system("cls");
  377. }
  378. print();
  379. printf("\n\n\nDo you want to search another?\n 1.Yes 2.No\n");
  380. int e;
  381. scanf("%d",&e);
  382. if(e==1)
  383. continue;
  384. else if(e==2)
  385. break;
  386.  
  387. }
  388. system("cls");
  389. break;
  390. }
  391. case 4:
  392. {
  393. while(1)
  394. {
  395. system("cls");
  396. print();
  397. create1();
  398. int e;
  399. print();
  400. printf("\n\n\nDo you want to Continue?\n1.Yes 2.No\n");
  401. scanf("%d",&e);
  402. if(e==1)
  403. continue;
  404. else if(e==2)
  405. break;
  406. }
  407. system("cls");
  408. break;
  409. }
  410. case 5:
  411. {
  412. system("cls");
  413. print();
  414. dis1();
  415. getch();
  416. system("cls");
  417. break;
  418. }
  419. case 6:
  420. {
  421. while(1)
  422. {
  423. system("cls");
  424. print();
  425. printf("\n\n\nEnter Id:\n");
  426. int k;
  427. scanf("%d",&k);
  428. int pos1 = search(k,0);
  429. if(pos1==-1)
  430. {
  431. system("cls");
  432. print();
  433. printf("\n\n\nNot Found\n");
  434. getch();
  435. system("cls");
  436. }
  437. else
  438. {
  439. system("cls");
  440. print();
  441. struct teacher *c;
  442. c=start1;
  443. int j;
  444. for(j=0; j<pos1-1; j++)
  445. {
  446. c=c->next;
  447. }
  448. printf("\n\n\nTeacher Name :%s\n",c->name);
  449. printf("\nTeacher ID :%d",c->id);
  450. printf("\nGroup :%s",c->group);
  451. printf("\nTeacher Gender :%s",c->gender);
  452. printf("\nPhone number :%ld",c->phnum);
  453. getch();
  454. system("cls");
  455.  
  456. }
  457. print();
  458. printf("\n\n\nDo you want to continue?\n1.Yes 2.No\n");
  459. int e;
  460. scanf("%d",&e);
  461. if(e==1)
  462. continue;
  463. else
  464. break;
  465. }
  466. system("cls");
  467. break;
  468. }
  469. case 7:
  470. {
  471. while(1)
  472. {
  473. system("cls");
  474. print();
  475. int x1,y1;
  476. printf("\n\n\nEnter Class: ");
  477. scanf("%d",&x1);
  478. printf("\nEnter Student ID: ");
  479. scanf("%d",&y1);
  480. system("cls");
  481. int k;
  482. //y=2;
  483. int pos1 = search(x1,y1);
  484. if(pos1==-1)
  485. {
  486. system("cls");
  487. print();
  488. printf("\n\n\nNot Found\n");
  489. getch();
  490.  
  491. }
  492. else
  493. {
  494. print();
  495. struct student *c;
  496. c=start;
  497. int j;
  498. for(j=0; j<pos1-1; j++)
  499. {
  500. c=c->next;
  501. }
  502. printf("\n\n\nName : %s %s\n",c->name,c->name1);
  503. printf("Bangla : ");
  504. scanf("%lf",&c->bangla);
  505. printf("\nEnglish: ");
  506. scanf("%lf",&c->english);
  507. printf("\nMath: ");
  508. scanf("%lf",&c->math);
  509. printf("\nPhysics: ");
  510. scanf("%lf",&c->physics);
  511. printf("\nChemistry: ");
  512. scanf("%lf",&c->chemistry);
  513. printf("\nBiology: ");
  514. scanf("%lf",&c->biology);
  515. //getch();
  516. system("cls");
  517. }
  518. int e;
  519. print();
  520. printf("\n\nDo you want to continue?\n1.Yes 2.No\n");
  521. scanf("%d",&e);
  522. if(e==1)
  523. continue;
  524. else
  525. break;
  526.  
  527. }
  528. system("cls");
  529. break;
  530. }
  531. case 8:
  532. {
  533. while(1)
  534. {
  535. system("cls");
  536. print();
  537. int x1,y1;
  538. printf("\n\nEnter Class: ");
  539. scanf("%d",&x1);
  540. printf("\nEnter Student ID: ");
  541. scanf("%d",&y1);
  542. system("cls");
  543. int k;
  544. int pos1 = search(x1,y1);
  545. if(pos1==-1)
  546. {
  547. printf("Not Found\n");
  548. getch();
  549. system("cls");
  550. }
  551. else
  552. {
  553. system("cls");
  554. struct student *c;
  555. c=start;
  556. int j;
  557. for(j=0; j<pos1-1; j++)
  558. {
  559. c=c->next;
  560. }
  561. print();
  562.  
  563. printf("\n\nName : %s %s Group: %s\nClass : %d Roll : %d\n",c->name,c->name1,c->group,c->cla,c->id);
  564. printf("Bangla : %.2lf\n",c->bangla);
  565. printf("\nEnglish: %.2lf\n",c->english);
  566.  
  567. printf("\nMath: %.2lf\n",c->math);
  568.  
  569. printf("\nPhysics: %.2lf\n",c->physics);
  570.  
  571. printf("\nChemistry: %.2lf\n",c->chemistry);
  572.  
  573. printf("\nBiology: %.2lf\n",c->biology);
  574.  
  575. getch();
  576. system("cls");
  577.  
  578. }
  579. int e;
  580. print();
  581. printf("Do you want to continue?\n1.Yes 2.No\n");
  582. scanf("%d",&e);
  583. if(e==1)
  584. continue;
  585. else if(e==2)
  586. break;
  587. }
  588. system("cls");
  589. break;
  590.  
  591.  
  592. }
  593. case 9:
  594. {
  595. exit = 1;
  596. break;
  597. }
  598.  
  599. }
  600. }
  601. }
  602. void admin()
  603. {
  604. int d=0;
  605. char c[10],p[10];
  606. while(1)
  607. {
  608.  
  609. system("cls");
  610. print();
  611. if(d==1)
  612. {
  613. system("cls");
  614. print();
  615. printf("\t\t\tWrong Password! Try again.");
  616. }
  617. printf("\n\n\n");
  618. printf("\t\t\t\tEnter User Name: ");
  619. scanf("%s",c);
  620. printf("\n");
  621. printf("\t\t\t\tEnter Password: ");
  622. scanf("%s",&p);
  623. if(strcmp(c,"techy5")==0 && strcmp(p,"121172")==0)
  624. {
  625. system("cls");
  626. print();
  627. printf("\t\t\tWelcome To Daffodil International School.\n\n\n");
  628. printf("\t\t\tPress any key to enter in the Admin Panel\n");
  629. getch();
  630. system("cls");
  631. break;
  632. }
  633. else
  634. {
  635. system("cls");
  636. d=1;
  637. //printf("Wrong Password! Try again.\n");
  638. continue;
  639. }
  640. }
  641. }
  642.  
  643. int main()
  644. {
  645. int x,y,ex=0,d=0;
  646. char c[10],p[10];
  647. while(1)
  648. {
  649. cls();
  650. print();
  651. printf("\n\n\n");
  652. printf("1.Admin Panel \n\n2.Student Panel.\n\n3.Exit.\n\n");
  653. scanf("%d",&x);
  654. switch(x)
  655. {
  656. case 1:
  657. {
  658. admin();
  659. getch();
  660. xnxx();
  661.  
  662. }
  663. }
  664. }
  665. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement