鱼C论坛

 找回密码
 立即注册
查看: 3895|回复: 4

求教大神 关于可视化界面

[复制链接]
发表于 2012-12-11 16:28:16 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
有木有C# 或 MDF 的教程 关于写学生管理系统的界面
还有 代码用C的写好了 老师要求写成可视化的 能不能直接用C的代码?
       其他一些是说保存成DLL格式的直接调用。。实在不懂 新手入门
求大神指导
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-12-11 19:59:19 | 显示全部楼层
1. 可以直接用C调用windows API显示界面,但是要涉及很多的繁杂细节,为了写这么一个小系统去学windows API不合适。
2.编译成DLL或COM等,同样需要了解很多细节。
3.比较靠谱的,就是去学C#都用C#来实现。
4.其实界面这种东西就是I/O,就是程序的一层外衣,会用的人可以给任何“程序内核”穿上任何衣服,但是要了解很多底层细节,这往往会使初学者感到挫败;不会的人又以为界面是现代程序设计的本质,其实最根本的还是Console串口下哪些程序的逻辑。
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-12-11 20:34:40 | 显示全部楼层

同感。。现在想用C#来完成编译好的C的代码
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<malloc.h>
  4. #define L sizeof(struct student)

  5. struct student      //结构体
  6. {
  7.     long number;    //学号
  8.         char name[10];  //姓名
  9.         char sex;       //性别
  10.         double escore;  //英语成绩
  11.         double cscore;  //C语言成绩
  12.     student *next;
  13. };
  14. int n,people=0;
  15. struct student *creat() //学生录入建立链表
  16. {
  17.         student *head1;
  18.         student *p1,*p2;
  19.         n=0;
  20.         int i=1;
  21.         p1=(student *)malloc(L);
  22.         head1=p1;
  23.         people=people+1;
  24.         printf("正在录入第%d个学生的信息\n",people);
  25.         printf("输入学号:");
  26.         scanf("%ld",&p1->number);
  27.         printf("输入姓名:");
  28.         scanf("%s",p1->name);
  29.         printf("输入性别(男m/女w):");
  30.         scanf("%s",&p1->sex);
  31.         printf("输入英语成绩:");
  32.         scanf("%ld",&p1->escore);
  33.         printf("输入C语言成绩:");
  34.         scanf("%ld",&p1->cscore);
  35.         printf("在输入学号处输入0返回主菜单\n\n");
  36.         p2=p1;
  37.        while(p1->number!=0)
  38.            {
  39.           if(n==0)       
  40.                   {
  41.                    head1=p1;
  42.                    n=1;
  43.                   }
  44.               else  p2->next=p1;
  45.               p2=p1;people=people+1;
  46.           p1=(student *)malloc(L);   
  47.                   printf("正在录入第%d个学生的信息\n",people);
  48.               printf("输入学号:");
  49.                   scanf("%ld",&p1->number);
  50.                    if(p1->number==0)        break;
  51.                    printf("输入姓名:");
  52.                    scanf("%s",p1->name);
  53.                    printf("输入性别:");
  54.                    scanf("%s",&p1->sex);
  55.                printf("输入英语成绩:");
  56.                    scanf("%ld",&p1->escore);
  57.                    printf("输入C语言成绩:");
  58.                    scanf("%ld",&p1->cscore);
  59.                    printf("在输入学号处输入0返回主菜单\n\n");
  60.            }
  61.         p2->next=NULL;
  62.         return(head1);
  63. }

  64. void input(struct student *head)//学生录入保存文件
  65. {
  66.         system("cls");
  67.         FILE *fp;
  68.         printf("\t\t\t\t************\n");
  69.         printf("\t\t\t\t* 录入系统 *\n");
  70.         printf("\t\t\t\t************\n");
  71.         struct student *p1=head;
  72.         if((fp=fopen("c:\\xx.dat","wb+"))==NULL)
  73.         {
  74.                 printf("文档正在被应用");
  75.                 return;
  76.         }
  77.         head=creat();
  78.     p1=head;
  79.         while(p1!=NULL)
  80.         {
  81.         fwrite(p1,L,1,fp);
  82.         p1=p1->next;
  83.         }
  84.         fclose(fp);
  85. }

  86. void lookover(struct student *head)//浏览系统输出
  87. {
  88.         system("cls");
  89.         struct student *p1;
  90.         p1=(student *)malloc(L);
  91.         printf("\t\t\t\t************\n");
  92.         printf("\t\t\t\t* 浏览系统 *\n");
  93.         printf("\t\t\t\t************\n");
  94.         FILE *fp;
  95.         fp=fopen("c:\\xx.dat","rb");
  96.         if(fp==NULL)
  97.         {
  98.                 printf("不能打开所选文件");
  99.                 return;
  100.         }
  101.         rewind(fp);
  102.         while(p1!=NULL)
  103.         {
  104.         fread(p1,L,1,fp);
  105.         printf("学号: %-6ld",p1->number);
  106.     printf("姓名: %-7s",p1->name);
  107.     printf("性别: %-5s",&p1->sex);
  108.     printf("英语成绩: %-6ld",p1->escore);
  109.     printf("C语言成绩: %-7ld\n\n",p1->cscore);
  110.         p1=p1->next;
  111.         }
  112.         printf("输入任意数返回主菜单");
  113.         char a;scanf("%s",&a);
  114.         fclose(fp);
  115.                 return;
  116. }

  117. void lookout(struct student *head)//学生查询
  118. {
  119.         system("cls");
  120.         struct student *p1;
  121.         int flag=1;
  122.         p1=(student *)malloc(L);
  123.         printf("\t\t\t\t************\n");
  124.         printf("\t\t\t\t* 查询系统 *\n");
  125.         printf("\t\t\t\t************\n");
  126.         FILE *fp;
  127.         fp=fopen("c:\\xx.dat","rb");
  128.             if(fp==NULL)
  129.                 {
  130.                 printf("不能打开所选文件");
  131.                 return;
  132.                 }
  133.             rewind(fp);
  134.             int number;
  135.             printf("请输入想要查询的学号");
  136.             scanf("%d",&number);
  137.                 printf("\n");
  138.                 while(p1!=NULL&&flag)
  139.                         {
  140.                     fread(p1,L,1,fp);
  141.                     if(p1->number==number)
  142.                                 {
  143.                      printf("学号: %-5ld",p1->number);
  144.                 printf("姓名: %-4s",p1->name);
  145.                 printf("性别: %-3s",&p1->sex);
  146.                 printf("英语成绩: %-4ld",p1->escore);
  147.                 printf("C语言成绩: %-4ld\n\n",p1->cscore);
  148.                                 flag=0;
  149.                                 }
  150.                     else p1=p1->next;
  151.                         }
  152.                         if(p1==NULL) printf("没有找到相应信息\n");
  153.             printf("输入任意数返回主菜单");
  154.             char a;scanf("%s",&a);
  155.             fclose(fp);
  156.                 return;
  157. }


  158. void cutoff(struct student *head)//学生删除   数据多的时候 从第二项到删除的前一项的数据没有
  159. {
  160.         system("cls");
  161.         struct student *p1,*p2,*h;
  162.         int flag=1;
  163.         p1=(student *)malloc(L);
  164.         printf("\t\t\t\t************\n");
  165.         printf("\t\t\t\t*删除系统 *\n");
  166.         printf("\t\t\t\t************\n");
  167.         FILE *fp;
  168.         fp=fopen("c:\\xx.dat","rb+");
  169.            if(fp==NULL)
  170.            {
  171.                 printf("不能打开所选文件");
  172.                 return;
  173.            }
  174.             rewind(fp);
  175.             int number;
  176.             printf("请输入想要删除的学号");
  177.             scanf("%d",&number);
  178.                 h=p1;
  179.                 p2=p1;
  180.                 while(p1!=NULL&&flag)
  181.                 {
  182.                         fread(p1,L,1,fp);
  183.                         if(p1->number==number)
  184.                         {
  185.                                 if(p1==head)
  186.                                 {
  187.                                         head=p1->next;free(p1);
  188.                                 }
  189.                                 else
  190.                                 {
  191.                                         p2->next=p1->next;
  192.                                 }
  193.                                 flag=0;       
  194.                                 printf("删除成功\n");
  195.                                 people=people-1;
  196.                         }
  197.                         else
  198.                         {
  199.                                 p2=p1;p1=p1->next;
  200.                         }
  201.                 }
  202.                 if(flag) printf("没有找到可以删除的数据\n");

  203.               fclose(fp);
  204.                       fp=fopen("c:\\xx.dat","rb+");
  205.                   if(fp==NULL)
  206.                           {
  207.                        printf("不能打开所选文件");
  208.                           return;
  209.                           }
  210.               //fseek(fp,(count-2)*sizeof(struct student),0);//什么意思
  211.                           fseek(fp,L,0);

  212.         while(p2!=NULL)
  213.         {
  214.            fwrite(p2,L,1,fp);
  215.          p2=p2->next;
  216.         }
  217.         printf("输入任意数返回主菜单");
  218.         char a;scanf("%s",&a);
  219.         fclose(fp);
  220.         return;               
  221. }

  222. void addup(struct student *head)//统计系统输出
  223. {
  224.         system("cls");
  225.         struct student *p1;
  226.         p1=(student *)malloc(L);
  227.         printf("\t\t\t\t************\n");
  228.         printf("\t\t\t\t* 统计系统 *\n");
  229.         printf("\t\t\t\t************\n");
  230.         FILE *fp;
  231.         fp=fopen("c:\\xx.dat","rb");
  232.         if(fp==NULL)
  233.         {
  234.                 printf("不能打开所选文件");
  235.                 return;
  236.         }
  237.         rewind(fp);
  238.         double  epeople=0,cpeople=0,people=0;
  239.         while(p1!=NULL)
  240.         {
  241.            fread(p1,L,1,fp);
  242.        epeople=epeople+p1->escore;
  243.            cpeople=cpeople+p1->cscore;
  244.            p1=p1->next;
  245.            people++;
  246.         }
  247.         printf("英语成绩%-6ld",epeople);
  248.         printf("C语言%-6ld",cpeople);
  249.         printf("输入任意数返回主菜单");
  250.         char a;scanf("%s",&a);
  251.         fclose(fp);
  252.                 return;
  253. }

  254. int ext()//退出
  255. {
  256.         printf("\t\t\t\t************\n");
  257.         printf("\t\t\t\t*退出系统 *\n");
  258.         printf("\t\t\t\t************\n");
  259.         printf("输入数字0确认退出系统");
  260.         int i;
  261.         scanf("%d",&i);
  262.         if(i==0)return(0);
  263.         else return(1);
  264. }
  265. int main()
  266. {
  267.         void input(struct student *p);
  268.         struct student *head;       //定义结构体的指针
  269.         int flag=1;char n;
  270.         int k,a,b;
  271.         for(k=0;k<=2;)
  272.         {
  273.         printf("用户名:");
  274.     scanf("%d",&a);
  275.         printf("密码:");
  276.         scanf("%d",&b);
  277.            if(a==1&&b==1)
  278.            {
  279.               while(flag)//教师系统
  280.                   {
  281.             system("cls");//清屏
  282.                 printf("\t\t\t\t************\n");
  283.                 printf("\t\t\t\t* 教师系统 *\n");
  284.                 printf("\t\t\t\t************\n");
  285.                  printf("\t\t\t*****************************\n");
  286.             printf("\t\t\t*   1----------学生录入\t*****\n");
  287.             printf("\t\t\t* 2----------学生浏览\t*****\n");
  288.             printf("\t\t\t*   3----------学生查询\t*****\n");
  289.             printf("\t\t\t* 4----------学生删除\t*****\n");
  290.             printf("\t\t\t*   5----------成绩统计\t*****\n");
  291.             printf("\t\t\t* 0----------退出系统\t*****\n");
  292.                 printf("\t\t\t*****************************\n");
  293.             printf("请选择(0----5)选择功能操作\n");
  294.             scanf("%d",&n);
  295.                   switch(n)
  296.                                   {
  297.                     case 1:input(head);break;
  298.                     case 2:lookover(head);break;
  299.                     case 3:lookout(head);break;
  300.                     case 4:cutoff(head);break;
  301.                     case 5:addup(head);break;
  302.                     case 0:flag=ext();k=3;break;
  303.                                   }
  304.                   }
  305.            }
  306.            else k++;
  307.         }
  308.         printf("感谢使用!\n");
  309.         return 0;
  310. }
复制代码
这个是学生管理系统的。想弄个可视化界面~求指导
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-12-11 22:24:42 | 显示全部楼层
幸福花开花落 发表于 2012-12-11 20:34
同感。。现在想用C#来完成编译好的C的代码这个是学生管理系统的。想弄个可视化界面~求指导

在C#中建立一个Student类,等同于你这里的struct Student以及哪些操作该结构体的函数。
在C#中建立一个Form,用于替代你现在main函数里的那些于用户交互的逻辑
剩下的只有你自己去看书了
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-12-12 10:06:25 | 显示全部楼层
仰望天上的光 发表于 2012-12-11 22:24
在C#中建立一个Student类,等同于你这里的struct Student以及哪些操作该结构体的函数。
在C#中建立一个F ...

OK ~感激不尽~~
小甲鱼最新课程 -> https://ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-16 20:32

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表