Click here to Skip to main content
15,886,689 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to start working on Crystal Report? Pin
CoderForEver20-Sep-09 0:47
CoderForEver20-Sep-09 0:47 
GeneralRe: How to start working on Crystal Report? Pin
Nagy Vilmos20-Sep-09 0:52
professionalNagy Vilmos20-Sep-09 0:52 
QuestionQuestion about AutoResetEvent Pin
Xmen Real 19-Sep-09 22:37
professional Xmen Real 19-Sep-09 22:37 
AnswerRe: Question about AutoResetEvent Pin
Nicholas Butler20-Sep-09 0:42
sitebuilderNicholas Butler20-Sep-09 0:42 
GeneralRe: Question about AutoResetEvent Pin
Xmen Real 20-Sep-09 6:45
professional Xmen Real 20-Sep-09 6:45 
QuestionTransparency on moving controls? Pin
Sindicoro19-Sep-09 20:09
Sindicoro19-Sep-09 20:09 
AnswerRe: Transparency on moving controls? Pin
Henry Minute19-Sep-09 20:57
Henry Minute19-Sep-09 20:57 
QuestionHelp with passing an array to a method Pin
Ceceily19-Sep-09 18:01
Ceceily19-Sep-09 18:01 
Why can't I get this to display how many answers are correct which are entered by the user? What am I doing wrong? Here's what I have.

Confused | :confused:

using System;

class Drivers_License_Exam
    {
        static void Main()
        {
            char[] exArray = new char[] { 'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A' };
            char[] userArray = new char[20];
            char ansHold;
            char[] correct = new char[20];
            //int correct = 0;

            //GET USER'S ANSWERS AND CONVERT TO UPPERCASE

            for (int i = 0; i < userArray.Length; i++)
            {
                Console.Write("Question #{0}: ", (i + 1));
                ansHold = Convert.ToChar(Console.ReadLine());
                ansHold = Char.ToUpper(ansHold);

                while (ansHold < 'A' || ansHold > 'D')
                {
                    Console.WriteLine("Invalid answer, please enter a letter A through D");
                    Console.Write("Question #{0}: ", (i + 1));
                    ansHold = Convert.ToChar(Console.ReadLine());
                    ansHold = Char.ToUpper(ansHold);

                }
                userArray[i] = ansHold; 
            }
            
            TotalCorrect(correct); 
        }
            public static void TotalCorrect(char[] userAnswers)
            {
                char[] examAnswers = new char[] { 'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A' }; 
                int[] wrongAnswers = new int[20];
                int j = 0; 
                int countCorrect = 0;


                for (int i = 0; i < 20; i++)
                {
                    if (userAnswers[i] == examAnswers[i])
                    {
                        countCorrect += 1;
                    }
                    else // wrong answer
                    {
                        wrongAnswers[j] = i + 1;
                        j++;
                    }
                    
                }
                Console.WriteLine("");
                Console.WriteLine("There are {0} correct answer(s).", countCorrect);
            }
    }

AnswerRe: Help with passing an array to a method Pin
Luc Pattyn19-Sep-09 18:13
sitebuilderLuc Pattyn19-Sep-09 18:13 
GeneralRe: Help with passing an array to a method Pin
Ceceily19-Sep-09 18:32
Ceceily19-Sep-09 18:32 
GeneralRe: Help with passing an array to a method Pin
Ceceily19-Sep-09 19:18
Ceceily19-Sep-09 19:18 
Questionretreiving values from datatable Pin
Rabia_Arif19-Sep-09 17:53
Rabia_Arif19-Sep-09 17:53 
AnswerRe: retreiving values from datatable Pin
Henry Minute19-Sep-09 21:15
Henry Minute19-Sep-09 21:15 
GeneralRe: retreiving values from datatable Pin
Rabia_Arif21-Sep-09 21:09
Rabia_Arif21-Sep-09 21:09 
AnswerRe: retreiving values from datatable Pin
Patrik.karlin20-Sep-09 0:42
Patrik.karlin20-Sep-09 0:42 
Questionhow to printpriview the datagridview data in c# Pin
Ramesh Reddy1111119-Sep-09 16:57
Ramesh Reddy1111119-Sep-09 16:57 
AnswerRe: how to printpriview the datagridview data in c# Pin
Christian Graus19-Sep-09 17:04
protectorChristian Graus19-Sep-09 17:04 
QuestionC# Word Interop - Insert Image into a specific cell in a table located in the document header Pin
jasonandrew19-Sep-09 14:08
jasonandrew19-Sep-09 14:08 
AnswerRe: C# Word Interop - Insert Image into a specific cell in a table located in the document header Pin
73amit17-Sep-10 0:45
73amit17-Sep-10 0:45 
AnswerRe: C# Word Interop - Insert Image into a specific cell in a table located in the document header Pin
AshokNaik10-Jul-11 21:45
AshokNaik10-Jul-11 21:45 
QuestionRe: C# Word Interop - Insert Image into a specific cell in a table located in the document header Pin
Member 110410579-Mar-15 0:50
Member 110410579-Mar-15 0:50 
QuestionImage position in other image c# ? [modified] Pin
sodevrom19-Sep-09 12:29
sodevrom19-Sep-09 12:29 
AnswerRe: Image position in other image c# ? Pin
Dave Kreskowiak19-Sep-09 14:01
mveDave Kreskowiak19-Sep-09 14:01 
GeneralRe: Image position in other image c# ? Pin
sodevrom19-Sep-09 14:06
sodevrom19-Sep-09 14:06 
GeneralRe: Image position in other image c# ? Pin
Dave Kreskowiak19-Sep-09 14:13
mveDave Kreskowiak19-Sep-09 14:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.