NTVDM CPU has encountered an unhandled exception

Jan 28, 2011 at 8:47pm
I made a c++ program but my teacher rejected it because i had used goto function everywhere. she told me that i can use do while instead. so i started replacing goto with do while. after spending so many hours on my desktop when i tried to run it , i got an error ,so strange that i do not even know where the error is as turbo c is not telling where it is .
it says
X#=0D,CS=0A97 IP=000001D1.The NTVDM CPU has encountered an unhandled exception .
plz somebody help me fast . i have spent more than required time on this project and am ending up nowhere. i have to finish it up fast as i have to study for my 12th final exams.

before do while (with goto function) ---working as i desire
http://www.4shared.com/file/0N3_4w4M/_comp_shop_2.html

after do while
http://www.4shared.com/file/Pl5xwxEU/_comp_shop.html

please help me.... Thanks in advance
Jan 28, 2011 at 9:22pm
What compiler, os and computer do you use?

Edit: I don't understand your teacher for rejecting SUCH A TASK for using goto btw
Last edited on Jan 28, 2011 at 9:23pm
Jan 28, 2011 at 9:39pm
I understand.

Goto's are evil and produce unreadable code.
Jan 29, 2011 at 5:44am
Indent your code.
Change your headers, you are using deprecated ones
1
2
3
4
5
6
7
8
9
10
11
#include<fstream>
//#include<conio.h>  Avoid it
#include<cstring>
#include<cstdio>   
//#include<process.h>    //for exit function
#include <cstdlib> //this one has exit
#include<iomanip>    
//#include<dos.h>   Avoid it
#include <iostream>

using namespace std;
You are using iostream an cstdio, you better just one.

I hope that your interface is created by meta-programming. You are practically controlling every position of the letters. What you will do if you want to add an statement?
That trick with the delay is useless, you are wasting your time coding it and the program is wasting resources executing it.
Another reason to avoid conio.h and dos.h is that they are not portable (I just commented the lines to compile)

Don't use gets, it could cause buffer overflow. replace it with cin.getline

You have an compiler error around line 900 if( cond=='2'||cond'3' ). And main must return int.
Change your compiler.

Try to separate your program in various files, definition from implementation.
Last edited on Jan 29, 2011 at 5:46am
Topic archived. No new replies allowed.