vendredi 4 août 2017

Invalid expression term 'else' need help thx

I´m a beginner with c# my Task is: (Array) Ask the user to enter a number and search the number in the list and Display (found / not found). I don´t know what I did wrong. Thanks for helping me.

using System.IO;
using System;

class Program
{
    static void Main()
    {
       //i have to explain the code sections (or check that you have incorrectly formatted all of your question as code).




//hello is there the mistake
        int[] arr = new [] {23,2,3,34,6,1,24,45,78,8};

        //who can I ask the user to type something in?
        Console.Write("What is your number: ");    
        Console.ReadLine();  


        {

        //a guy sad i should use a Loop but how do i do that?    
        if (userInput1 = 23);
        if (userInput1 = 2);
        if (userInput1 = 3);
        if (userInput1 = 34);
        if (userInput1 = 6);
        if (userInput1 = 1);
        if (userInput1 = 24);
        if (userInput1 = 45);
        if (userInput1 = 78);
        if (userInput1 = 8) ;  

        } 
         //i have to explain the code sections (or check that you have incorrectly formatted all of your question as code).

        ConsoleWriteLine("found");            


          //how do i have to place the brakeds  

        {
        else if; 
        }    
            (ConsoleReadLine("not found");

        //i have to explain the code sections (or check that you have incorrectly formatted all of your question as code).


    }
}

Aucun commentaire:

Enregistrer un commentaire