Thread: C++ Problem

  1. #1
    Registered User
    Join Date
    Mar 2005

    Smile 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 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

  2. #2
    Registered User
    Join Date
    Mar 2005
    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?


  3. #3
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Welcome to the boards. If you haven't already done so then please take some time to familiarise yourself with the faq:

    Make sure you have a look at the the posting guidelines:
    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:
    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,


    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  4. #4
    Registered User
    Join Date
    Mar 2005
    I ran this in the UNIX system at school:
    g++ lander.cpp -o 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

  5. #5
    Join Date
    Aug 2002
    Tucson, Arizona
    Here you go
    %include ""	
    segment .data
    printThis      db    "Do your own homework",0
    printThis2    db    "And post things that make sense",0
    segment .bss
    segment .text
    	enter	0,0
    	mov	eax,printThis
    	call	print_string
    	call	print_nl
    	mov	eax,printThis2
    	call	print_string
    	call	print_nl
    	mov	eax,0
    Last edited by prog-bman; 03-03-2005 at 12:29 PM.

  6. #6
    Join Date
    Feb 2002
    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:
    	if( argc != 3 )
    		return 1;
    That should fix those problems.

    edit: Also, don't include cpp files. Let the linker do its job.
    Last edited by pianorain; 03-03-2005 at 01:49 PM.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM