Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 C++ debug error on turing? What?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Insectoid




PostPosted: Fri Apr 18, 2008 9:20 am   Post subject: C++ debug error on turing? What?

I am making a simple program in turing that mimics a vending machine. I have put 6 pictures in, and it works fine. unfortunately, I tried to put in another picture in a different spot further down the code and got a strange error!

I got an error poppup from 'Microsoft Visual C++ Debug Library' that says

Quote:


Debug assertion failed!

Program C:\program files\turing\turing.exe
File: dbgheap.c
line: 1044

For more information...bla bla bla



Then, if I click 'Abort', turing closes.
if I click 'ignore' the program runs without the picture.
if I click 'retry' (to debug) I get another error message

Quote:

The environment (not your program) has crashed.

This error is caused by a bug in the environment and is not you fault!
details about the crash have been saved in \\bla bla bla...

if possible, please e-mail to: yadda @ bla.com
cause of crash: Breakpoint reached



Note- I was not debugging while running the program, I was just...running it.
I'm not even running C++!

Help appreciated!
Very appreciated...
If it doesn't get fixed...I fail...
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Fri Apr 18, 2008 9:33 am   Post subject: Re: C++ debug error on turing? What?

Source code and the "blah blah blah" file would be nice. Can't help you otherwise. Please do not forget to post the graphics too. PM if you are afraid of code stealing.
Insectoid




PostPosted: Fri Apr 18, 2008 9:37 am   Post subject: RE:C++ debug error on turing? What?

Okay, Here's my code:

code:

%********************************************************************
%   Jordan Dykstra                                                  *
%   April 16                                                        *
%   This program allows the user to order a candy bar and recieve   *
%   change as required                                              *
%********************************************************************



%***********************************
%   Variables
var money : int % The ammount of money put into the machine
var change : int % The remaining change
var total : int % The total cost of the item
var item : string (1) % The item (getch'ed from user)
var twent : int := 2000 %*\
var ten : int := 1000 %****\
var five : int := 500 %*****\
var toon : int := 200 %******\
var loon : int := 100 %*******\ setting the value of coins
var quart : int := 25 %*******/ Like the fancy slashes???
var dime : int := 10 %*******/
var nick : int := 5 %*******/
var penn : int := 1 %******/
var totaltwent : int %\
var totalten : int %*\
var totalfive : int %*\
var totaltoon : int %**\
var totalloon : int %***\
var totalquart : int %***\ The number of coins
var totaldime : int %****/
var totalnick : int %***/
var totalpenn : real %*/

%music
process PlayMusic
    Music.PlayFile ("cd")
end PlayMusic

% Picture loading...
Pic.ScreenLoad ("coffeecrisp.jpg", 100, 275, picCopy)
Pic.ScreenLoad ("caramilk.jpg", 100, 198, picCopy)
Pic.ScreenLoad ("rolo.jpg", 100, 50, picCopy)
Pic.ScreenLoad ("skittles.jpg", 300, 275, picCopy)
Pic.ScreenLoad ("smarties.jpg", 300, 198, picCopy)
Pic.ScreenLoad ("wonkabar.jpg", 320, 50, picCopy)
%*****************************************


%Draw a box to outline machine
Draw.Line (100, 350, 500, 350, green)
Draw.Line (100, 50, 100, 350, green)
Draw.Line (500, 50, 500, 350, green)
Draw.Line (100, 50, 500, 50, green)
%*****************************************




%*****************************************
%   Calculate cost of item               *
%*****************************************
setscreen ("nocursor")
color (brightgreen)
put "                           "..
put "Enter Item code"
loop
    getch (item)
    if item = "a" then
        total := 125
    elsif item = "b" then
        total := 150
    elsif item = "c" then
        total := 75
    elsif item = "d" then
        total := 175
    elsif item = "e" then
        total := 250
    elsif item = "f" then
        total := 225
    else
        put "Invalid option. "
    end if
exit when item = "a"
exit when item = "b"
exit when item = "c"
exit when item = "d"
exit when item = "e"
exit when item = "f"   
end loop
%*****************************************
% This is the problem picture
Pic.ScreenLoad ("vendingmachine.jpg", 50, 100, picCopy)
setscreen ("nocursor")
color (brightgreen)
cls
put "                  "..
put "please insert coin or bill"
put "             "..
put "Only coins or bills in the denominations of"
put "             "..
put "1, 2, 5, 10, and 20 are accepted."
get money
money := money * 100
change := money - total


totaltwent := change div twent
change := change mod twent

totalten := change div ten
change := change mod ten

totalfive := change div five
change := change mod five

totaltoon := change div toon
change := change mod toon

totalloon := change div loon
change := change mod loon

totalquart := change div quart
change := change mod quart

totaldime := change div dime
change := change mod dime

totalnick := change div nick
change := change mod nick

totalpenn := change

put "Your change is:"
if totaltwent > 0 then
    put totaltwent, " twenties"
end if
if totalten > 0 then
    put totalten, " tens"
end if
if totalfive > 0 then
    put totalfive, " fives"
end if
if totaltoon > 0 then
    put totaltoon, " toonies"
end if
if totalloon > 0 then
    put totalloon, " loonies"
end if
if totalquart > 0 then
    put totalquart, " quarters"
end if
if totaldime > 0 then
    put totaldime, " dimes"
end if
if totalnick > 0 then
    put totalnick, " nickels"
end if
if totalpenn > 0 then
    put totalpenn, " pennies"
end if



fork PlayMusic
Insectoid




PostPosted: Fri Apr 18, 2008 9:44 am   Post subject: RE:C++ debug error on turing? What?

After 'line: 1044' there is a bit I missed before:

Quote:

Expression:_CrtIsValidHeapPointer(pUserData)
For more information on how your program can cause an assertion failure, please see the Visual C++ documentation on asserts.


This is a school computer, so the "blah blah blah" file was saved in "\\cwdhs-cfs\home\students\dykstjor\panic.log"

E-mail bug to: Readybugs@hsa.on.ca

hope that helps.
andrew.




PostPosted: Fri Apr 18, 2008 8:28 pm   Post subject: Re: C++ debug error on turing? What?

insectoid @ Fri Apr 18, 2008 9:20 am wrote:
I'm not even running C++!


Turing isn't natively supported so it's being run in a C++ environment. So, yeah, you are really using C++ with Turing syntaxes. And about your problem, no idea. I've never seen it before.
CodeMonkey2000




PostPosted: Sat Apr 19, 2008 10:13 am   Post subject: RE:C++ debug error on turing? What?

The correct term is that it's interpreted Wink
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: