简体   繁体   中英

I'm having issues makin a simple input and output program

Okay So I work visual c# when i want to put this line

enter code here




static void Main(string[] args)
        {
            Console.ReadLine a, b, c, max;

        }
    }
}

but it says this error about the ReadLine part: The type name "ReadLine" does not exist in the type 'Console'

What's This??? Go and read MSDN documentation first. The error is cause ReadLine() is a method but you are trying to use it as a type by itself. It should just be below assuming you have already declared a variable named a and it's of type string .

a = Console.ReadLine();

Read Console.ReadLine Method () . documentation has few good examples which will help in clear your doubts.

Console.ReadLine is a method, so it should be used like this:

Console.WriteLine("Enter something"); //this will print the text to the screen
string inputText = Console.ReadLine(); // Get string from the input and assign it to the inputText variable

You can see an additional reference here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM