我的程序给了我一个空白屏幕并显示此错误
“错误1错误C1075:在左括号'{'at”之前找到的文件结尾 请帮忙!
以下是代码:
#include "stdafx.h"
#include<iostream>
#include<ctime>
#include <cstdlib>
#include <time.h>
using namespace std;
int randomnumber();
int main(void)
{
int iGuesses;
int iUser1;
int iUserguess;
char cDoagain;
while(true)
system("CLS");
system("COLOR 2");
iGuesses = rand() % 100 +1;
cout << "NumberGuesser"
<< endl;
do
{
cout << "The Number is " << iGuesses << endl;
std::cout << "Press ENTER to continue...";
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
system("PAUSE");
return 0;
}
谢谢你们!
答案 0 :(得分:3)
您有几个错误,并且可以通过一致的缩进来发现它们
这是具有合理格式的相同代码:
#include "stdafx.h"
#include<iostream>
#include<ctime>
#include <cstdlib>
#include <time.h>
using namespace std;
int randomnumber();
int main(void)
{
int iGuesses;
int iUser1;
int iUserguess;
char cDoagain;
while(true)
system("CLS");
system("COLOR 2");
iGuesses = rand() % 100 +1;
cout << "NumberGuesser" << endl;
do
{
cout << "The Number is " << iGuesses << endl;
std::cout << "Press ENTER to continue...";
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
system("PAUSE");
return 0;
}
while(true)
拥有更大的范围main
功能永远不会完成。