Thread: questions and answers from a file

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    3

    Smile questions and answers from a file

    ..how can i put a scoring in a C program?,i have to make a program in C that display 10 questions from a text file. each questions should be displayed one by one and ask the user to choose an answer from the choices given by the program. The correct answer should be identified using a flag. I have no idea how to do this.Please help me. Thanks a lot

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Please read ... Homework Policy

    Give it your best shot and when you get stuck post your code and we'll see what we can do.

    Generally adding scoring is simply a matter of initializing a couple of variables that count the number of right and wrong answers.

  3. #3
    Registered User
    Join Date
    Jul 2011
    Posts
    3
    uhmm sorry,i'm just new in C and i'm just making my question clear..but thanks for reminding ..can you give me a sample code on how scoring is implemented in a C program?

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by jaralvarado View Post
    uhmm sorry,i'm just new in C and i'm just making my question clear..but thanks for reminding ..can you give me a sample code on how scoring is implemented in a C program?
    No. Read the homework policy.

    We are not here to write your programs for you and this is not a "free code" dispensary...
    Try to do this on your own. If you get stuck (really stuck, not lazy stuck) post your code.

  5. #5
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    How would you implement scoring without a computer? Let's say you asked the 10 questions to someone and then you were going to grade them, what is it that you would do?
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Show us what you're capable of doing for yourself at the moment.

    For example, if all you can do is print the entire file without stopping, then show us that code, and make your question "how to I stop..."

    If you can read each question, and display answers, but don't know how to flag the correct one, then do that much.

    And so on.

    Then we help you with the bit you're really stuck on.

    Oh, and I fixed the title to be something less vague.
    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.

  7. #7
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by Salem View Post
    .........
    Oh, and I fixed the title to be something less vague.
    But then we will never find out about those cookies....
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  8. #8
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by AndrewHunter View Post
    But then we will never find out about those cookies....
    Peanut butter, chocolate chip, please!


    @jaralvarado ... it's not that we don't want to help you. It is that we want you to demonstrate that you are making an effort on your own. If you are sincerely interested in learning C and programming, you will show some ambition... To try and fail is far better than to not try at all.
    Last edited by CommonTater; 07-24-2011 at 08:36 AM.

  9. #9
    Registered User
    Join Date
    Jul 2011
    Posts
    3
    no,uhmm i'm just asking for the basic function/syntax/code(i' sorry i don't know how it should be called) that should be used. Hmm,okay i'll make a pr0gram tonight but i can post it tomorrow because i'm just new in C hehe..thank you guyz for the advice , i will l0g out for the mean time. I'll be back tomorrow c:

  10. #10
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by jaralvarado View Post
    no,uhmm i'm just asking for the basic function/syntax/code(i' sorry i don't know how it should be called) that should be used. Hmm,okay i'll make a pr0gram tonight but i can post it tomorrow because i'm just new in C hehe..thank you guyz for the advice , i will l0g out for the mean time. I'll be back tomorrow c:
    Ok, we'll be here!

    The thing is that, in the learning phases of programming, the worst thing you can do is use other people's codes (what we call "Scoop and Poop" programming). That's not how you learn... you learn by doing, by having to think it through, by struggling with it. Those lessons will stay with you... that nice bit of copied code will not.

  11. #11
    Registered User
    Join Date
    May 2009
    Posts
    4,183

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Yo, immediate need of suggestions or answers
    By Dinames in forum C Programming
    Replies: 1
    Last Post: 06-07-2011, 07:39 AM
  2. Answers plz!!!
    By tipp2007 in forum C Programming
    Replies: 7
    Last Post: 12-14-2007, 02:03 AM
  3. Giving Whole Answers to Questions
    By Kleid-0 in forum A Brief History of Cprogramming.com
    Replies: 59
    Last Post: 01-30-2005, 10:26 PM
  4. Wrong Answers
    By SpudNuts in forum C Programming
    Replies: 5
    Last Post: 12-16-2004, 02:59 AM
  5. why different answers for this equation
    By james_nkh in forum C Programming
    Replies: 2
    Last Post: 05-21-2002, 12:29 PM