简单女包:大家帮我看看这段C++源程序编译怎么老出错?

来源:百度文库 编辑:高校问答 时间:2024/04/30 11:27:03
// Listing 2.2 using std::cout
#include <iostream>
int main()
{
std::cout << "Hello there.\n";
std::cout << "Here is 5: " << 5 << "\n";
std::cout << "The manipulator std::endl ";
std::cout << writes a new line to the screen.";
std::cout << std::endl;
std::cout << "Here is a very big number:\t" << 70000;
std::cout << std::endl;
std::cout << "Here is the sum of 8 and 5:\t";
std::cout << 8+5 << std::endl;
std::cout << "Here's a fraction:\t\t";
std::cout << (float) 5/8 << std::endl;
std::cout << "And a very very big number:\t";
std::cout << (double) 7000 * 7000 << std::endl;
std::cout << "Don't forget to replace Jesse Liberty";
std::cout << "with your name...\n";
std::cout << "Jesse Liberty is a C++ programmer!\n";
return 0;
}
我用的编译器是Dev-c++4.编译这段程序时总显示
"std::cout << "Here's a fraction:\t\t";"这句出错,错误是:“unterminated character constant”
这是什么意思?怎样才可以解决?

要用专义字符,改成:
std::cout << "Here\'s a fraction:\t\t";

std::cout << writes a new line to the screen.";
少了一个双引号。