
哪位高手帮忙看看这段程序是哪出问题了?
#include<iostream>intmian(){std::cout<<"hellothere!\n";std::cout<<"Hereis5:"<<5<<"\n"...
#include <iostream>
int mian()
{
std::cout<<"hello there!\n";
std::cout<<"Here is 5:"<<5<<"\n";
std::cout<<"The manipulator std::end1";
std::cout<<"wtites a new line to the screen.";
std::cout<<std::end1;
std::cout<<"Here is a very big number:\t"<<70000;
std::cout<<std::end1;
std::cout<<"Here is the sum of 8and 5:\t";
std::cout<<8+5<<std::end1;
std::cout<<"here's a fraction:\t\t";
std::cout<<(float)5/8<<std::end1;
std::cout<<"And a very very big number:\t";
std::cout<<(double)7000*7000<<std::end1;
std::cout<<"Don't forget to replace jesse Liberty";
std::cout<<"with yuor name...\n";
std::cout<<"Jesse Liberty is a C++ programmer!\n";
return 0;
}
出错信息
ompiling...
stade up.cpp
h:\c++\stade up.cpp(9) : error C2039: 'end1' : is not a member of 'std'
h:\c++\stade up.cpp(9) : error C2065: 'end1' : undeclared identifier
h:\c++\stade up.cpp(11) : error C2039: 'end1' : is not a member of 'std'
h:\c++\stade up.cpp(13) : error C2039: 'end1' : is not a member of 'std'
h:\c++\stade up.cpp(15) : error C2039: 'end1' : is not a member of 'std'
h:\c++\stade up.cpp(17) : error C2039: 'end1' : is not a member of 'std'
执行 cl.exe 时出错.
stade up.obj - 1 error(s), 0 warning(s) 展开
int mian()
{
std::cout<<"hello there!\n";
std::cout<<"Here is 5:"<<5<<"\n";
std::cout<<"The manipulator std::end1";
std::cout<<"wtites a new line to the screen.";
std::cout<<std::end1;
std::cout<<"Here is a very big number:\t"<<70000;
std::cout<<std::end1;
std::cout<<"Here is the sum of 8and 5:\t";
std::cout<<8+5<<std::end1;
std::cout<<"here's a fraction:\t\t";
std::cout<<(float)5/8<<std::end1;
std::cout<<"And a very very big number:\t";
std::cout<<(double)7000*7000<<std::end1;
std::cout<<"Don't forget to replace jesse Liberty";
std::cout<<"with yuor name...\n";
std::cout<<"Jesse Liberty is a C++ programmer!\n";
return 0;
}
出错信息
ompiling...
stade up.cpp
h:\c++\stade up.cpp(9) : error C2039: 'end1' : is not a member of 'std'
h:\c++\stade up.cpp(9) : error C2065: 'end1' : undeclared identifier
h:\c++\stade up.cpp(11) : error C2039: 'end1' : is not a member of 'std'
h:\c++\stade up.cpp(13) : error C2039: 'end1' : is not a member of 'std'
h:\c++\stade up.cpp(15) : error C2039: 'end1' : is not a member of 'std'
h:\c++\stade up.cpp(17) : error C2039: 'end1' : is not a member of 'std'
执行 cl.exe 时出错.
stade up.obj - 1 error(s), 0 warning(s) 展开
展开全部
出错原因是,那个是endl(小写L),不是end1!
还有:不用每句输出语句语句前面都加上std::
直接在#include <iostream>下面加上一句using namespace std;就行
#include <iostream>
using namespace std;
int main()
{
cout<<"hello there!\n";
cout<<"Here is 5:"<<5<<"\n";
cout<<"The manipulator std::endl";
cout<<"wtites a new line to the screen.";
cout<<endl;
cout<<"Here is a very big number:\t"<<70000;
cout<<endl;
cout<<"Here is the sum of 8and 5:\t";
cout<<8+5<<endl;
cout<<"here's a fraction:\t\t";
cout<<(float)5/8<<endl;
cout<<"And a very very big number:\t";
cout<<(double)7000*7000<<endl;
cout<<"Don't forget to replace jesse Liberty";
cout<<"with yuor name...\n";
cout<<"Jesse Liberty is a C++ programmer!\n";
return 0;
}
还有:不用每句输出语句语句前面都加上std::
直接在#include <iostream>下面加上一句using namespace std;就行
#include <iostream>
using namespace std;
int main()
{
cout<<"hello there!\n";
cout<<"Here is 5:"<<5<<"\n";
cout<<"The manipulator std::endl";
cout<<"wtites a new line to the screen.";
cout<<endl;
cout<<"Here is a very big number:\t"<<70000;
cout<<endl;
cout<<"Here is the sum of 8and 5:\t";
cout<<8+5<<endl;
cout<<"here's a fraction:\t\t";
cout<<(float)5/8<<endl;
cout<<"And a very very big number:\t";
cout<<(double)7000*7000<<endl;
cout<<"Don't forget to replace jesse Liberty";
cout<<"with yuor name...\n";
cout<<"Jesse Liberty is a C++ programmer!\n";
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询