Online quiz Project help

This is a discussion on Online quiz Project help within the C++ Programming forums, part of the General Programming Boards category; I have got an Project for my Class XII ONLINE QUIZ i need to ask the user to select the ...

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    11

    Cool Online quiz Project help

    I have got an Project for my Class XII
    ONLINE QUIZ

    i need to ask the user to select the subject and then i must ask the questions relating the subject

    After 30 SEC if the user doesn't answer i need to CHANGE THE QUESTION,but i don't have any idea of how to change it within 30 sec

    then i need to option for the examiner to change and modify( or delete) question
    and i am thinking of using a structure containing the following
    1.Play(by the user)
    2.Modify question(for examiner)
    3.Add questions(for examiner)
    4.Exit

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,765
    Now judging from your name, and your IP address (which we moderators can see), I'm guessing you want an answer that is compatible with the TurboC fossil your educational institutions just love to push on the unsuspecting masses.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Giridhar Sanjay View Post
    After 30 SEC if the user doesn't answer i need to CHANGE THE QUESTION,but i don't have any idea of how to change it within 30 sec
    That's going to be the hard part, and the solution is probably platform/library specific, IF you mean this is an active timer.

    BUT if you mean you can just time how long it takes for the user to answer, and if it takes more than 30 seconds, you say "Too late, new question", then that is easy. Use time() and subtract then from now to give you the elapsed time.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Registered User
    Join Date
    Jun 2011
    Posts
    11
    Quote Originally Posted by Salem View Post
    Now judging from your name, and your IP address (which we moderators can see), I'm guessing you want an answer that is compatible with the TurboC fossil your educational institutions just love to push on the unsuspecting masses.
    Yea,i know moderators can view IP address as i am a Mod to a similar site like this one!! but unpopular
    Chemistry Help Forum


    Quote Originally Posted by MK27 View Post
    That's going to be the hard part, and the solution is probably platform/library specific, IF you mean this is an active timer.

    BUT if you mean you can just time how long it takes for the user to answer, and if it takes more than 30 seconds, you say "Too late, new question", then that is easy. Use time() and subtract then from now to give you the elapsed time.
    Back to my question,
    subtract then from now? what does it actually mean & time() represents a function or what?
    Sorry for the inconvenience,i am new and weak in C++ (doesn't mean i am strong in C)

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Yes, time() is a standard function from <ctime>, or <time.h>. It returns seconds since the epoch:

    Code:
    time_t then = time(NULL);
    [....]
    time_t now = time(NULL);
    if (now - then >= 30) ...
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    Registered User
    Join Date
    Jun 2011
    Posts
    11
    1.Play(by the user)
    2.Modify question(for examiner)
    3.Add questions(for examiner)
    4.Exit

    For the above should i use a class for it?
    And is there an alternate way of doing it instead of using time.h? and i think i need to use timer instead of this i think though
    __________________________________________________ ________________________________

    Why is that i can't access all privileges like viewing my profile
    Last edited by Giridhar Sanjay; 07-01-2011 at 09:28 AM.

  7. #7
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,509
    For the above should i use a class for it?
    And is there an alternate way of doing it instead of using time.h? and i think i need to use timer instead of this i think though
    You could put a Question and its answer in a class...containing all the functions(modify,show..etc)..
    AFAIK :The Alternatives are not portable...eg: gettimeofday ..(which btw..can give an accuracy up to nanoseconds!! )
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  8. #8
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Giridhar Sanjay View Post
    i think i need to use timer instead of this i think though
    I doubt it, because that will involve multi-threading, by you or a library, and considering this is more or less your first C++ program, no one is going to expect that and you'd be crazy to try.

    Why is that i can't access all privileges like viewing my profile
    You need a minimum number of posts, I think 6 or so.

    You could use classes if you have covered them in your course, otherwise don't worry, this is a basic I/O exercise.
    Last edited by MK27; 07-01-2011 at 10:05 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  9. #9
    Registered User
    Join Date
    Jun 2011
    Posts
    11
    Quote Originally Posted by manasij7479 View Post
    You could put a Question and its answer in a class...containing all the functions(modify,show..etc)..
    AFAIK :The Alternatives are not portable...eg: gettimeofday ..(which btw..can give an accuracy up to nanoseconds!! )
    But what shall i do for adding questions??
    I think structures may also be useful

  10. #10
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,509
    Use std::vector if you're permitted...(If it seems new to you, remember it is not at all difficult to understand)
    If your class or structure is QA:
    Code:
    std::vector<QA> mylist; //declaring it
    mylist.push_back(your_new_QA_object); //adds another
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  11. #11
    Registered User
    Join Date
    Jun 2011
    Posts
    11
    std::vector is not allowed for us,
    thanks guys i got an idea of how to do now
    i will try to do on from here

  12. #12
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by MK27 View Post
    Yes, time() is a standard function from <ctime>, or <time.h>. It returns seconds since the epoch:

    Code:
    time_t then = time(NULL);
    [....]
    time_t now = time(NULL);
    if (now - then >= 30) ...
    You shouldn't be using "-" there, as time_t might not be an integer type and might not have an minus operator. You should really use difftime(now, then), at least if it needs to be portable.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seeking Programmers/Developers For The Sims Online Project
    By samee.woods in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 06-16-2011, 05:48 AM
  2. Help with a C Programing Quiz project
    By dilemma in forum C Programming
    Replies: 12
    Last Post: 05-15-2009, 04:35 PM
  3. my Quiz
    By hanadi in forum C++ Programming
    Replies: 5
    Last Post: 01-14-2009, 12:43 PM
  4. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 01:48 AM
  5. Quiz
    By coolazz0 in forum C++ Programming
    Replies: 10
    Last Post: 02-04-2003, 11:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21