![]() |
| ||
| any idea how to assign values to specific variables hi im a noob in C#. just learning by my self. need to know how to assign values to variables. which we input normally in C we use scanf ne. but in C#. how we gonna assign |
| ||
| Re: any idea how to assign values to specific variables If you use the console to input data then use Console.ReadLine() as follow Say that you want to enter a string Console.WriteLine("enter your name"); string Name = Console.ReadLine(); Now if you want enter variable other than string Console.WriteLine("Enter your age"); int Age = Convert.ToInt32(Console.ReadLine()); |
| ||
| Re: any idea how to assign values to specific variables superb. let me try it now :D |
| ||
| Re: any idea how to assign values to specific variables If you are satisfied please mark the tread as solved Happy coding |
| ||
| Re: any idea how to assign values to specific variables can you tell me how to put OR in C# |
| ||
| Re: any idea how to assign values to specific variables I think you should have marked the post solved for him as this is a different question bro C# conditional OR operator is || http://msdn.microsoft.com/en-us/libr...5d(VS.80).aspx |
| ||
| Re: any idea how to assign values to specific variables Quote:
normally in c we r use scanf() in C#.net console.write() write to console and stop console.writeln() going to next line console.ReadLine() for user input |
| ||
| Re: any idea how to assign values to specific variables Beforehand, sorry for my english... The || - is short version of |. I.e. if you have simple condition like this: (a||b) then, there is no difference, what operator to use. In case with complex condition: ((a==b)||(c==d)||(e==f)) will be difference. The || operator will be checking the conditions, untill it find TRUE. If it happened on (a==b), the other conditions will not be checked. If you are choose the | operator, then all conditions will be checked necessarily. |
| ||
| Re: any idea how to assign values to specific variables Quote:
|| is a conditional OR, it works with booleans : Abool || Bbool, if Abool is true it won't look at Bbool. | is a bitwise OR it works with booleans and with integral types, it will always perform a bitwise OR on both sides. Look at this code snippet I found on MSDN(search for C# operators) class ConditionalOr |
| All times are GMT -4. The time now is 9:49 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC