-
C++ Problem
I've been trying to figure this out for the past 6 hours. When you run this program, lander.exe, (you may download it at http://jprotege.com/c2) in dos with the command line "lander.exe sonic 100", the program outputs text, but does not output the O's . I believe a function is not being called properly in lander.cpp
I believe the problem is in lander.cpp
What can I add to my code to make the O's output onto the screen when I run the lander.exe in dos?
My project is this:
You have to produce a program that automatically navigates a lunar module lander down an increasingly narrow canyon in the lunar surface. Note that this means that there is no interactive keyboard input, and the lander moves entirely under program control. The progress of the lander is output in the following format, with the canyon walls represented by the "O" character and the landing pod by"V"
Thank You
-
my TA stated:
all you have to do is write your output to an array, then output the
entire array to the screen
it would mean instead of all those cursor to calls,
you just write a character to the screen array
then when you've finished all the drawing to the
array, just give that array to writeconsoleoutput
How do I go about doing this?
Thanks
-
Welcome to the boards. If you haven't already done so then please take some time to familiarise yourself with the faq:
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
Make sure you have a look at the the posting guidelines:
http://cboard.cprogramming.com/annou...ouncementid=51
Following the rules will ensure you get a prompt answer to your question.
Remember, too, that the board has a search facility, a link is at the top of your screen:
http://cboard.cprogramming.com/search.php
It will often get you a quicker answer to your questions than waiting for a response to one you have posted.
It appears that you are posting a homework assignment or other project.
Please don't ask people to do all your work for you, See the announcement on Homework at the top of all forums to see what is acceptable or PM me. Basically people are happy to help, but they're not going to do it all for you.
Show us what you've got, show your code (using code tags), or where you're confused and someone will be happy to help you I'm sure. If it's something that you absolutely don't understand how it works, like you have no clue how qsort works, then ask a general question about the function and I'm sure someone will explain it. Though they may not give you all of the code for it, but someone will explain the concept.
On obivous homework questions especially, I like to remind people of the board's ninth guildeline, while this board is very helpful to people, make sure you have your instructor's permission before seeking help on assignments. While people on these boards are more than happy to help, we discourage people from asking for help on graded work without the instructor's permission, and we claim no repsonsibilty for any cheating or honor violations.
Feel free to PM me with any questions.
Good Luck,
Kermi3
-
I ran this in the UNIX system at school:
g++ lander.cpp -o lander.exe
lander.exe
segmentation fault (core dumped)
I also tried:
g++ lander.cpp -o lander.exe
lander.exe sonic 100
AHH!!Please remember to enter a speed of either Crawl, Slow, Medium, Fast, Sonic
Please also remember to enter a fuel amount that is not a negative number
-
Here you go
Code:
%include "asm_io.inc"
segment .data
printThis db "Do your own homework",0
printThis2 db "And post things that make sense",0
segment .bss
;nothing
segment .text
enter 0,0
pusha
mov eax,printThis
call print_string
call print_nl
mov eax,printThis2
call print_string
call print_nl
mov eax,0
popa
leave
ret
-
Well, first you need to make sure that arguments are present before you starting look for them. Check argc more closely before accessing argv[1]. I think you meant to do something like this:
Code:
if( argc != 3 )
{
outputError();
return 1;
}
That should fix those problems.
edit: Also, don't include cpp files. Let the linker do its job.