CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: C# Program

  1. #1
    Join Date
    Apr 2012

    Unhappy C# Program

    Hi, I have been given four programs to complete I have completed 3 but cant get my head around this. can someone help me please

    Write a class-based program for the following problem.
    An examination consists of 10 true or false type questions. A
    solution to the exam can be represented as a string of ten
    characters where each character is either 'T' if the answer to
    the corresponding question is true or 'F', if the answer to the
    corresponding question is false. For instance, the string
    "TTFFFTFTTF" indicates that the answers to questions 1,2,6,8 and
    9 are true, whose those to questions 3,4,5,7 and 10 are false.
    The program should mark such an exam. It should read and store
    the string representing the correct solution, and should then
    read the candidate number and the string representing the answers
    as given by each the candidate who took the exam. It should then
    print out the mark obtained by that candidate.

  2. #2
    Join Date
    Jan 2010

    Re: C# Program

    It would help us help you if you explained what is it that you cant wrap your head around.
    Have you tried anything? Brainstormed some quick ideas? Not necessarily correct, but something to get you started. Pen&paper help a lot.
    You can't solve a problem without putting some time and effort into thinking about it.

  3. #3
    Join Date
    Apr 2012
    Ontario, Canada

    Re: C# Program

    Sounds like you need to be able to store a Student Number (candidate number), the Correct Answer String, and the InputAnswer String. You then have to print out the Student Number and the number of correct answers the student received. To do that you need to compare the two strings, probably by looping through each letter, and use an integer to count how many are right out of 10.

    I.E. The correct string is TTFFTTFFTT and input string is TFFFFTFFTT then you loop through the input string, compare it to the answer string, and you should have 8. Then you print it out. Not sure if your teacher wants it printed on paper or on screen, but thats the gist. Hope I helped.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)