C ++代码错误,cout语句 [英] Error in C++ code, cout statement

查看:113
本文介绍了C ++代码错误,cout语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <conio.h>
#include <string>
#include <stdio.h>
#include <stdlib.h>

using namespace std;


int main()
{

    int accumulator =0;
  
       


    getch();
    return 0;
}


:mad:默认cout后出现错误


:mad:error after default cout has an error

推荐答案

如果未编译:
不是
If it doesn''t compile :
It''s not
Cout<<"Error: Wrong operation code. Program halt";


但是


but

cout<<"Error: Wrong operation code. Program halt";



干杯



Cheers


默认提示出现错误后出现错误"
不是很有帮助!
这说明您输入的数据包含的值除以100不在您的已知指令列表中.

意见建议:
修改default错误报告以提供更多信息:

"error after default cout has an error"
Is not very helpful!
All that says is that your incoming data contains value that when divided by 100 is not in your list of known instructions.

Suggestions:
Modify the default error report to give more information:

i          So you know which line inyour input has the error
memory[i]  So you know the raw data which causes it.
opCode     So you know what value the switch statement is trying (and failing) to find
operand    For completeness.

我将另外输出累加器,并提供可选的内存转储,以便在需要时可以查看故障程序的快照.

我将创建一个例程来提供所有这些功能,因此我可以在遇到任何问题时都可以这样做,并且可能还会添加是否继续执行?"问题.

I would additionally output the accumulator, and provide an optional memory dump so that I could see a shapshot of the faulty program if I needed it.

I would create a routine to provide all this, so I could do it whenever I had a problem, and probably add a "Continue execution anyway?" question.


这篇关于C ++代码错误,cout语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆