| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 423 人关注过本帖
标题:请高手帮我看看哪出问题啦!
取消只看楼主 加入收藏
andyhu1a
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-1-2
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
请高手帮我看看哪出问题啦!
// yk.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<conio.h>
struct score
{
   int math;
   int c;
   int english;
};
struct stu
{
  char name[20];
  char sex;
  long number;
  struct score sub;
}stu[77];
void Input()
{
  int i;
  for(i=0;i<77;i++)
  scanf("%s\n",stu[i].name);
  scanf("%s\n",&stu[i].sex);
  scanf("%ld\n",&stu[i].number);
  scanf("%d\n",&stu[i].sub.math);
  scanf("%d\n",&stu[i].sub.c);
  scanf("%d\n",&stu[i].sub.english);
}
void Output()
{
    int i;
    for(i=0;i<77;i++)
    printf("%s\t%s\t%ld\t%d\t%d\t%d\t",stu[i].name,stu[i].sex,stu[i].number,stu[i].sub.math,stu[i].sub.c,stu[i].sub.english);
}
void Information()
{
  int a,i,k;
  char j[20];
  printf("***********Use Name(1)**********\n");
  printf("***********Use Number(2)*********\n");
  scanf("%d\n",a);
if(a==1)
{
 scanf("%s\n",j);
 for(i=1;i<77;i++)
 {
   if(strcmp(j,stu[i].name)==0)
   printf("%s\t%s\t%ld\t%d\t%d\t%d\t",stu[i].name,stu[i].sex,stu[i].number,stu[i].sub.math,stu[i].sub.c,stu[i].sub.english);
 }
}
if(a==2)
 {
   scanf("%d\n",k);
   for(i=0;i<77;i++)
   {
     if(stu[i].number==k)
     printf("%s\t%s\t%ld\t%d\t%d\t%d\t",stu[i].name,stu[i].sex,stu[i].number,stu[i].sub.math,stu[i].sub.c,stu[i].sub.english);
    }
  }      
if(a!=(1||2))
printf("***********Error,Sign Out**************\n");
}
void Summation()
{
 int a,b,j,k,i,sum,sum1,sum2,sum3;
 printf("********Personal(1)*********\n");
 printf("********Subject(2)********\n");
 scanf("%d\n",a);
 if(a==1)
 {   
      printf("*********Please Input Serial Number**********\n");
      scanf("%d",i);   
   sum=(stu[i].sub.math+stu[i].sub.c+stu[i].sub.english);
   printf("%s,%d\n",stu[i].name,sum);
  }
 if(a==2)
 {
      printf("*********math(1)***********\n");
      printf("*********c(2)***********\n");
      printf("*********english(3)***********\n");
   scanf("%d\n",b);
   if(b==1)
       {
            for(j=0;j<77;j++)
            sum1=sum+stu[i].sub.math;
            printf("math of sum=%d\n",sum);
        }
        if(b==2)
       {
            for(j=0;j<77;j++)
            sum2=sum+stu[i].sub.c;
            printf("c of sum=%d\n",sum);
        }
        if(b==3)
       {
            for(j=0;j<77;j++)
            sum3=sum+stu[i].sub.english;
            printf("english of sum=%d\n",sum);
        }
  }
  if(a!=(1||2))
  printf("***********Error,Sign Out**************\n");        
}
void Average()
{
 int a,b,j,k,i,sum,sum1,sum2,sum3;
 float average,average1,average2,average3;
 printf("********Personal(1)*********\n");
 printf("********Subject(2)********\n");
 scanf("%d\n",a);
 if(a==1)
 {   
      printf("*********Please Input Serial Number**********\n");
      scanf("%d",i);   
   sum=(stu[i].sub.math+stu[i].sub.c+stu[i].sub.english);
   average=(sum/3);
   printf("%s,%f\n",stu[i].name,average);
  }
 if(a==2)
 {
      printf("*********math(1)***********\n");
      printf("*********c(2)***********\n");
      printf("*********english(3)***********\n");
   scanf("%d\n",b);
   if(b==1)
       {
            for(j=0;j<77;j++)
            sum1=sum+stu[i].sub.math;
            average1=(sum1/3);
            printf("math of average=%f\n",average1);
        }
        if(b==2)
       {
            for(j=0;j<77;j++)
            sum2=sum+stu[i].sub.c;
            average2=(sum2/3);
            printf("c of average=%f\n",average2);
        }
        if(b==3)
       {
            for(j=0;j<77;j++)
            sum3=sum+stu[i].sub.english;
            average3=(sum3/3);
            printf("english of average=%f\n",average3);
        }
  }
  if(a!=(1||2))
  printf("***********Error,Sign Out**************\n");        
}
main()
{  
    int i,j;
  i=1;
printf("welcome to\n");
printf("***********Input(1)***********\n");
printf("***********Output(2)***********\n");
printf("***********Find Information(3)***********\n");
printf("***********Scroe Summation(4)***********\n");
printf("***********Score Average(5)***********\n");
printf("***********Sign Out(6)*************\n");
printf("**Be Careful:You Must First Input**\n");
while(i!=0)
{
  scanf("%d\n",j);
  switch(j)
 {
     case 1: Input();printf("**********complete************\n");break;
     case 2: Output();printf("**********complete************\n");break;
     case 3: Information();printf("**********complete************\n");break;
     case 4: Summation();printf("**********complete************\n");break;
     case 5: Average();printf("**********complete************\n");break;
     case 6: printf("**********Thank You To Use************\n");return 0;
    }
}
}




vs2010总出现错误    25    error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int    c:\users\acer\documents\visual studio 2010\projects\yk\yk\yk.cpp    163    1    yk
搜索更多相关主题的帖子: english 应用程序 include return number 
2012-01-02 22:19
andyhu1a
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-1-2
收藏
得分:0 
此问题已经解决,怎么运行会无法保存数据
2012-01-03 01:17
快速回复:请高手帮我看看哪出问题啦!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026622 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved