Thread: Confused Student

  1. #16
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Don't take Miracle C too seriously. It doesn't conform to the standard much. May I recommend downloading Dev-C++ from www.bloodshed.net (get the latest version 4.9.9.1 I think - it supports both C and the new standard of C++). It's a very good compiler that most of us use.

    As for the errors, I'm afraid I can't help much. Look around in some of the compiler options and see if you can toggle between C and C++ mode. Other than that the only thing I can recommend is posting your latest code. (I'm afraid my copy of VS.NET is on another PC right now).

  2. #17
    Registered User
    Join Date
    Jan 2005
    Posts
    28
    Alright, so I finally got Dev-C++ (many mirrors are down.)

    It's much simpler when it comes to C than VS.NET. ...However, when I compile and run the program, it closes immediatley after I input all of my values. My professor mentioned that this might happen, and instructed us to include a char done; variable as well as the command scanf("%c", &done); right before the return0.

    ...Causing you to have to strike any key inorder to close out the program (because it termintes as soon as it finishes it's required processes.)
    ...However, I made this change, and it still doesn't seem to do anything. I've even included a printf and none show up after it calculates what it was required to calculate.

    Is there something I'm leaving out?
    And could anyone please direct me to a source on how to make the 4 inputs only 2?


    Thanks for all of your help!

  3. #18
    Registered User
    Join Date
    Jul 2004
    Posts
    68
    You can run it on the command line and not require the extra code to keep the console open.

  4. #19
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    This is the FAQ on that - might help you

    http://faq.cprogramming.com/cgi-bin/...&id=1043284385

    ~/

  5. #20
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    After reading this:

    Quote Originally Posted by kermit
    This is the FAQ on that - might help you

    http://faq.cprogramming.com/cgi-bin/...&id=1043284385

    ~/
    Try something like:
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385

  6. #21
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    which is linked from the FAQ that I posted...

  7. #22
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Wierd - same URL, yet I get different results...

  8. #23
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    I was just saying that I pointed to the page I did because it had a small amount of possibly relevant information, plus it also contained a link pointing to the other FAQ on getting a program to wait for a keypress. But whatever.

  9. #24
    Registered User
    Join Date
    Jan 2005
    Posts
    28
    Thanks for the help-

    I pretty much have that terminating thing resolved, for the most part.

    Does anyone have any information on how to do the thing with the input? ...Where I would have 4 variables inputted into 2 scanf prompts? (...each separated by a space, as far as I know)

    Could anybody direct me to a reference where I can figure this out?


    Thanks again for all of the help!

  10. #25
    Not just a squid...
    Join Date
    Sep 2004
    Posts
    25

    Multiple Inputs

    There are several sites that can help you if you just google for scanf,
    but here is the quick answer:

    When you use a scanf statment you can have the user input a string of multiple values each separated by a delimiter. For example if you were asking someone to enter a date in month-day-year format you would simply code your scanf in that same format.

    Code:
    scanf("%d-%d-%d", &month, &day, &year);
    When their input is read in the scanf ignores the delimiter that matches up with the same character in the user's input string. In your example you are just using a space as the delimiter.

  11. #26
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    the site has a wonderful tutorial section. what you need to do first is to get familiar with all the functions and things like that in c++. there is lots of info in the tutorial section. get yourself familiar with the datatypes, loops and things like that from the tutorials. that will help you a lot in your coding and once you understand the syntax and stuff, you will be able to find errors on your own.
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  12. #27
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    > Don't take Miracle C too seriously.
    Oh god no, someone isn't trying to use that piece of crap are they???
    The only miracle is how the author gets away with charging money for it.
    Even crusty old borland turbo C has more features, and that's saying something!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  13. #28
    Registered User
    Join Date
    Jan 2005
    Posts
    28
    That about sums it up, thanks for all of your help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Updating in a sequential file?
    By Ronnyv1 in forum C Programming
    Replies: 1
    Last Post: 03-24-2009, 04:41 PM
  2. Database assignment is Killing me!
    By Boltrig in forum C Programming
    Replies: 2
    Last Post: 11-29-2007, 03:56 AM
  3. LinkList Sorting in C
    By simly01 in forum C Programming
    Replies: 3
    Last Post: 11-25-2002, 01:21 PM
  4. Creating a student grade book-how?
    By Hopelessly confused in forum C Programming
    Replies: 5
    Last Post: 10-03-2002, 08:43 PM
  5. A few tips please...
    By gems in forum C++ Programming
    Replies: 4
    Last Post: 04-11-2002, 02:28 PM