Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
#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:error after default cout has an error
Posted
Updated 5-Feb-11 6:46am
v6
Comments
Abhinav S 5-Feb-11 3:49am    
Any idea where you get this error?
OriginalGriff 5-Feb-11 3:52am    
What error is it?
Compilation? - where and what message?
Run time? - where and what message?
Program bug? - What happens and shouldn't, or doesn't happen and should?
Estys 5-Feb-11 12:53pm    
You've edited all of the relevant code out of the question. Why?

If it doesn't compile :
It's not
Cout<<"Error: Wrong operation code. Program halt";

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


Cheers
 
Share this answer
 
Comments
OriginalGriff 5-Feb-11 4:08am    
Good one! I didn't notice that...:thumbsup" and 5
"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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900