day (1-31)
Month (1-12)
Year(0-99)
Can you help me This code is wrong but is something like this i think.
Module
Module1 Sub Main() Dim MyDate As IntegerConsole.WriteLine("enter day!")
MyDate = ((Console.ReadLine) << 3)
Console.WriteLine("enter month!")
MyDate = ((Console.ReadLine) << 6)
Console.WriteLine("enter year!")
MyDate = ((Console.ReadLine) << 0)
Console.WriteLine(MyDate)
End Sub
End Module

Help << operator VB. net
cdun2
jackline
I need to use >> and << for this program.
Ok I now saw that I ask you a wrong question.
The code is something like this...Can you now help me
Test Date (07.03.2005)
***************************************************************************************
Sub
Main() Dim MyDate As Integer
Console.WriteLine("Enter day!")MyDate = ((Console.ReadLine) << )
Console.WriteLine(
"enter month!")MyDate = ((Console.ReadLine) << )
Console.WriteLine(
"Enter year!")MyDate = ((Console.ReadLine) << )
Console.WriteLine(
"The day is :{0}", MyDate >> )Console.WriteLine(
"The month is:{1}", MyDate >> )Console.WriteLine(
"The year is:{2}", MyDate >> )
End SubEnd
Modulehazz
try something like this:
Sub Main()
Dim day as integer, month as integer, year as integer
Console.WriteLine("enter day!")
day = cint(Console.ReadLine)
Console.WriteLine("enter month!")
month = cint(Console.ReadLine)
Console.WriteLine("enter year!")
year = cint(Console.ReadLine)
Console.WriteLine("Date = " & day & "/" & month & "/" & year)
End Sub
why use a console program, who wants to type at the command-line create a GUI and the use the dateTimePicker control. much easier :)
Yahya
It's very "wrong". << is for bit shifting.
Why not explain what you are trying to accomplish instead of having us guess
SelvaVenkatesh
tr_sreedhar
dim myDate, temp as Integerconsole.Write("unesite dan (1-31): ")'direktno u varijablumyDate <<= 4console.Write("unesite mjesec (1-12): ")myDate = myDate Or console.ReadLine()myDate <<= 7console.Write("unesite godinu (0-99): ")myDate = myDate Or Console.ReadLine()console.WriteLine()console.WriteLine("dan je: {0}", myDate >> 11)temp = myDate >> 11myDate = myDate and (not temp)console.WriteLine("mjesec je: {0}", myDate >> 7)temp = myDate >> 7temp <<= 7myDate = myDate and (not temp)console.WriteLine("godina je: {0}",myDate)console.ReadLine()End Subpangitko79
LouArnold
You aren't listening to people here. You use shift operators when THEY answer an application need.
It does not seem as if you understand what they do and I'd recommend looking at the shift operator in help for a clearer understanding.
You have not declated a datatype for mydate. Therefore, it's going to default to an integer with what you have written. The argument and the shift operators will tell the compiler to make it an integer. However an integer is a far, far less than optimal datatype to store date fields,
You have to first understand what a shift operator does to decide to use it. I do not think you have found the application for them ...yet.