| | |
any idea how to assign values to specific variables
Please support our C# advertiser: Intel Parallel Studio Home
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 alignment app array barchart bitmap box broadcast c# c#gridviewcolumn cast check checkbox client combobox communication control conversion csharp custom database datagrid datagridview dataset datatable datetime degrees development draganddrop drawing elevated encryption enum excel file focus form format forms function gdi+ hospitalmanagementsystem httpwebrequest image index input install java label list listbox localization login mandelbrot math messagebox mouseclick mysql operator path photoshop picturebox pixelinversion plotting pointer post programming radians read regex remote remoting richtextbox server sleep socket sql statistics stream string stringformatting sun table text textbox thread time timer update usercontrol validation visualstudio webbrowser whileloop windows winforms wpf xml






