| | |
any idea how to assign values to specific variables
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Thread Solved
![]() |
•
•
Join Date: Oct 2007
Posts: 172
Reputation:
Solved Threads: 16
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());
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());
•
•
Join Date: Jul 2007
Posts: 276
Reputation:
Solved Threads: 37
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
C# conditional OR operator is ||
http://msdn.microsoft.com/en-us/libr...5d(VS.80).aspx
•
•
Join Date: Aug 2008
Posts: 1
Reputation:
Solved Threads: 1
•
•
•
•
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
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
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.
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.
So what if you can see the darkest side of me?
No one would ever change this animal I have become
Help me believe it's not the real me
Somebody help me tame this animal
No one would ever change this animal I have become
Help me believe it's not the real me
Somebody help me tame this animal
•
•
•
•
Originally Posted by Antenka
The || - is short version of |.
|| 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)
C# Syntax (Toggle Plain Text)
class ConditionalOr { static bool Method1() { Console.WriteLine("Method1 called"); return true; } static bool Method2() { Console.WriteLine("Method2 called"); return false; } static void Main() { Console.WriteLine("regular OR:"); Console.WriteLine("result is {0}", Method1() | Method2()); Console.WriteLine("short-circuit OR:"); Console.WriteLine("result is {0}", Method1() || Method2()); } } /* Output: regular OR: Method1 called Method2 called result is True short-circuit OR: Method1 called result is True */
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
![]() |
Other Threads in the C# Forum
- Previous Thread: Convert DataView to DataTable
- Next Thread: getting value of return value of stored procedure to code behined,with patterns prace
| Thread Tools | Search this Thread |
.net access algorithm app application array bitmap box c# check checkbox client color combo combobox concurrency control conversion csharp custom customactiondata cyclethruopenforms data database datagrid datagridview dataset datatable date/time datetime degrees dll draganddrop drawing enabled encryption enum excel file filename finalyearproject form format forms function gdi+ getoutlookcontactusinfcsvfile globalization gtk image input install installer java keypress list localization math microsoftc#visualexpress mono mouseclick mysql operator panel path photoshop picturebox pixelinversion post programming radians regex remoting richtextbox save server sleep socket sql sql-server statistics string table text textbox thread time timer timespan update usercontrol users validate validation visualstudio webbrowser wia winforms wpf xml






