Code: Show/Hide int age; cout<<"enter your age: "; cin>>age; cout<<"you entered "<<age; |
Code: Show/Hide int age; printf("Enter your age: "); scanf("%d",age); printf("you entered %d",age); |
hellzlaker wrote: | |
I just read a topic somewhere else and turns out in the C# you dont use cout or printf but you use their new function Console.WriteLine("Hello World!");
and its closer to printf but i dont get why do they have to keep changing shit? this is how the input age works in c#
|
Code: Show/Hide Console.WriteLine("Please enter your age"); int age = Int32.Parse(Console.ReadLine()); Console.WriteLine("You entered " + age); |
hellzlaker wrote: |
I just read a topic somewhere else and turns out in the C# you dont use cout or printf but you use their new function Console.WriteLine("Hello World!");
and its closer to printf but i dont get why do they have to keep changing shit? this is how the input age works in c# string input; int age; Console.WriteLine("Please enter your age"); input = Console.ReadLine(); age = Int32.Parse(myInput); Console.WriteLine("You entered {0}", age); now just tell me how gay is first impression of c# is? |
Code: Show/Hide Console.WriteLine("You entered " + age.toString() ); |
Code: Show/Hide Console.Write("You entered ");
Console.WriteLine(age); |
Blocks wrote: |
Mr Ekted uses goto? I never knew him, but I thought better of him. |
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: |
And I think it was him who said that cout actually uses printf internally. |
D1st0rt wrote: |
@Ani: if you put the Show() method body into ToString() you would be able to Console.WriteLine(class); |
Animate Dreams wrote: |
[..]
elaborate You mean, within my class definition, define a string ToString() method? |
Code: Show/Hide public class MyClass { public override string ToString() { return "String Representation of Class"; } } |
Animate Dreams wrote: |
so myclass.tostring is automatically called when someone tries to treat the class as a string? |