| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1498 人关注过本帖
标题:返回错误的状态码
只看楼主 加入收藏
借我一辈子
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2017-6-8
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
返回错误的状态码
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
ifstream infile;
ofstream outfile;
outfile.open("student.dat");
int main()
{
    cout<<"please input grades in order."<<endl;
    int i,j;
    int b[3][7];
    for(i=0;i<7;i++)
    {
        cout<<"please input the "<<i+1<<"student's grades.(english,math,physic)"<<endl;
        for(j=0;j<3;j++)
        {
            cin>>b[j];
            if(b[j]>100||b[j]<0)
            cout<<"it's error grade.please input again."<<endl;
            outfile>>b[j];
        }
        cout<<endl;
    }
    return 0;
}
[u]为什么会返回错的状态码?求助!!
搜索更多相关主题的帖子: english include please 
2017-06-08 10:51
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9025
专家分:54030
注 册:2011-1-18
收藏
得分:10 
为什么会返回错的状态码?
听不懂你在说什么,能编译通过吗?
2017-06-08 11:22
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:10 

1>------ 已启动全部重新生成: 项目: w20, 配置: Debug Win32 ------
1>Build started 2017-6-9 14:34:38.
1>_PrepareForClean:
1>  Deleting file "Debug\w20.lastbuildstate".
1>InitializeBuildStatus:
1>  Touching "Debug\w20.unsuccessfulbuild".
1>ClCompile:
1>  w20.cpp
1>d:\c_source\w16\w20\w20.cpp(9): error C2143: 语法错误 : 缺少“;”(在“.”的前面)
1>d:\c_source\w16\w20\w20.cpp(9): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\c_source\w16\w20\w20.cpp(9): error C2371: “outfile”: 重定义;不同的基类型
1>          d:\c_source\w16\w20\w20.cpp(8) : 参见“outfile”的声明
1>d:\c_source\w16\w20\w20.cpp(20): error C2678: 二进制“>>”: 没有找到接受“std::istream”类型的左操作数的运算符(或没有可接受的转换)
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(1053): 可能是“std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,signed char *)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(1060): 或       “std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,signed char &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(1067): 或       “std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,unsigned char *)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(1074): 或       “std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,unsigned char &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(1097): 或       “std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char *)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(1104): 或       “std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(1111): 或       “std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char *)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(1118): 或       “std::basic_istream<_Elem,_Traits> &std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(1128): 或       “std::basic_istream<_Elem,_Traits> &std::operator >><char,std::char_traits<char>,int[7]>(std::basic_istream<_Elem,_Traits> &&,_Ty (&))”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Ty=int [7]
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(179): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_istream<_Elem,_Traits> &(__cdecl *)(std::basic_istream<_Elem,_Traits> &))”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(185): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_ios<_Elem,_Traits> &(__cdecl *)(std::basic_ios<_Elem,_Traits> &))”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(192): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::ios_base &(__cdecl *)(std::ios_base &))”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(199): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::_Bool &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(218): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(short &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(253): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned short &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(272): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(int &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(298): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned int &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(316): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(long &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(334): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned long &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(354): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(__int64 &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(373): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(unsigned __int64 &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(392): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(float &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(411): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(double &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(429): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(long double &)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(447): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(void *&)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          f:\program files\microsoft visual studio 10.0\vc\include\istream(466): 或       “std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator >>(std::basic_streambuf<_Elem,_Traits> *)”
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          尝试匹配参数列表“(std::istream, int [7])”时
1>d:\c_source\w16\w20\w20.cpp(21): error C2446: “>”: 没有从“int”到“int *”的转换
1>          从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换
1>d:\c_source\w16\w20\w20.cpp(21): error C2040: “>”:“int [7]”与“int”的间接寻址级别不同
1>d:\c_source\w16\w20\w20.cpp(23): error C2088: “>>”: 对于 class 非法
1>  stdafx.cpp
1>  正在生成代码...
1>
1>生成失败。
1>
1>Time Elapsed 00:00:00.84
========== 全部重新生成: 成功 0 个,失败 1 个,跳过 0 个 ==========

DO IT YOURSELF !
2017-06-09 14:34
快速回复:返回错误的状态码
数据加载中...
 
   



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

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