在用c ++调试程序时,我得到一个空白屏幕

1 c++ debugging visual-studio visual-studio-2012

现在发生的事情(在编辑代码之后)是每当我键入多个单词时,它就会出现痉挛.任何修复?谢谢.对不起,如果我好像什么都不知道.昂贵的书籍和没人教我,让我在线阅读教程.(编辑后的代码如下.)

#include <iostream>
#include <string>
using namespace std;

string qu;

int y;

int main()
{
y = 1;
while (y == 1)
{
    cout << "Welcome to the magic 8-ball application." <<"\nAsk a yes or no question, and the 8-ball will answer." << "\n";
    cin >> qu;
    cout << "\nProccessing...\nProccessing...\nProccessing...";
    cout << "The answer is...: ";
    int ans = (int)(rand() % 6) + 1;
    if (ans == 1)
        cout << "Probably not.";
    if (ans == 2)
        cout << "There's a chance.";
    if (ans == 3)
        cout << "I don't think so.";
    if (ans == 4)
        cout << "Totally!";
    if (ans == 5)
        cout << "Not a chance!";
    if (ans == 6)
        cout << "75% chance.";
    system("CLS");
    cout << "\nWant me to answer another question?" << "(1 = yes, 2 = no.)";
    cin >> y;
    }

return 0;

}
Run Code Online (Sandbox Code Playgroud)

tao*_*ocp 5

 while (y = 1);
Run Code Online (Sandbox Code Playgroud)

应该

 while (y == 1)
Run Code Online (Sandbox Code Playgroud)

你有额外的;,应该使用==.