[Message Deleted]
-
Hi, you need some variables when reading from the console. Here is a way to get a number (note the use of PRE tags for readability):
Console.WriteLine("please enter number:");
string s=Console.ReadLine();
int number;
bool OK=int.TryParse(s, out number);
if (OK) {
Console.WriteLine("You entered the number "+number);
} else {
Console.WriteLine("Unacceptable input: "+s);
}:)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi, you need some variables when reading from the console. Here is a way to get a number (note the use of PRE tags for readability):
Console.WriteLine("please enter number:");
string s=Console.ReadLine();
int number;
bool OK=int.TryParse(s, out number);
if (OK) {
Console.WriteLine("You entered the number "+number);
} else {
Console.WriteLine("Unacceptable input: "+s);
}:)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Dear Luc Pattyn, Thank you very much for your help, however the brackets are still red and the error message is still there. Thank you very much for oyur help and sorry for the inconvenience, Aman
Hi, what brackets? do you mean the parentheses? did you put your code inside a method, the method inside a class, the class inside a namespace? if there is an error message, give it as is. if it specifies a line number, check that line. work on the first error message first. and teach your IDE to always show line numbers, see #102 here[^] :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi, what brackets? do you mean the parentheses? did you put your code inside a method, the method inside a class, the class inside a namespace? if there is an error message, give it as is. if it specifies a line number, check that line. work on the first error message first. and teach your IDE to always show line numbers, see #102 here[^] :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Dear Luc Pattyn, I have fixed this problem, the problem was that one of the settings for c# was changed. I dont know how that happened. I just reset all the settings to default and that worked. Thank you very much for helping, Aman
Hi Aman, you're welcome. BTW: Please don't delete any messages, they should remain visible to keep the thread intelligible and available for future reference. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi Aman, you're welcome. BTW: Please don't delete any messages, they should remain visible to keep the thread intelligible and available for future reference. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi Luc, Right sorry i just thought that if i kept it open people would have thought that this is still a issue/problem. I did not know that you where ment to keep it open , thank you for telling me i now know :) Thank you, Aman
What you can do is: - add "(SOLVED)" to the subject line of the original post - click "good answer" on the reply that did it for you (that removes it from the "unanswered questions" list) :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.