Click here to Skip to main content
15,905,563 members
Home / Discussions / C#
   

C#

 
GeneralRe: Focus Problems in C# Pin
ptrainor14-Mar-04 6:43
ptrainor14-Mar-04 6:43 
GeneralChanging Form Client Region Pin
forak13-Mar-04 6:58
forak13-Mar-04 6:58 
GeneralRe: Changing Form Client Region Pin
Mathew Hall13-Mar-04 16:45
Mathew Hall13-Mar-04 16:45 
GeneralDirectX Bitmaps Pin
Flecko13-Mar-04 5:02
Flecko13-Mar-04 5:02 
GeneralRe: DirectX Bitmaps Pin
Hiro_Antagonist13-Mar-04 10:33
Hiro_Antagonist13-Mar-04 10:33 
GeneralRe: DirectX Bitmaps Pin
Flecko13-Mar-04 11:32
Flecko13-Mar-04 11:32 
GeneralRe: Extract Data from XML -> DataSet -> DataGrid Pin
John Fisher13-Mar-04 7:57
John Fisher13-Mar-04 7:57 
GeneralConsole Application Pin
mil_an13-Mar-04 3:58
mil_an13-Mar-04 3:58 
Hi,

I have little experience writing code, so your help is much needed, and will be really appreciated....please help!!

I need to build a CONSOLE application, written in C#, It should cycle thru the states as shown:

Stop -> Prepare to Go,
Prepare to Go -> Go,
Go -> Prepare to Stop.



Thanks...in advance
__________________________________________

This is what I have come up with till now, but it seems wrong:

using System;

namespace traffic_light
{
///
/// Summary description for Class1.
///


enum State
{
prepare_to_go,
go,
prepare_to_stop,
stop,
}


class Class1
{

private State _state;

public Class1()
{
_state = State.prepare_to_go;
Console.WriteLine ( _state );

_state = State.go;
Console.WriteLine ( _state );

_state = State.prepare_to_stop;
Console.WriteLine ( _state );

_state = State.stop;
Console.WriteLine ( _state );

}
}

}
GeneralRe: Console Application Pin
John Fisher13-Mar-04 4:26
John Fisher13-Mar-04 4:26 
GeneralRe: Console Application Pin
mil_an13-Mar-04 10:24
mil_an13-Mar-04 10:24 
GeneralRe: Console Application Pin
Nick Parker13-Mar-04 10:45
protectorNick Parker13-Mar-04 10:45 
GeneralRe: Console Application Pin
mil_an13-Mar-04 8:12
mil_an13-Mar-04 8:12 
GeneralRe: Console Application Pin
CWIZO13-Mar-04 8:28
CWIZO13-Mar-04 8:28 
GeneralRe: Console Application Pin
oOomen13-Mar-04 22:11
oOomen13-Mar-04 22:11 
QuestionHow can a class call one of its own accessors? Pin
Adrian Stanley13-Mar-04 3:57
Adrian Stanley13-Mar-04 3:57 
AnswerRe: How can a class call one of its own accessors? Pin
John Fisher13-Mar-04 4:20
John Fisher13-Mar-04 4:20 
AnswerRe: How can a class call one of its own accessors? Pin
Jeff Varszegi13-Mar-04 16:15
professionalJeff Varszegi13-Mar-04 16:15 
AnswerRe: How can a class call one of its own accessors? Pin
Michael Flanakin17-Mar-04 19:19
Michael Flanakin17-Mar-04 19:19 
GeneralDataGrid Sorting Pin
jazzle13-Mar-04 3:37
jazzle13-Mar-04 3:37 
GeneralRe: DataGrid Sorting Pin
Mazdak13-Mar-04 9:40
Mazdak13-Mar-04 9:40 
GeneralRe: DataGrid Sorting Pin
jazzle13-Mar-04 10:42
jazzle13-Mar-04 10:42 
GeneralRe: DataGrid Sorting Pin
Mazdak13-Mar-04 18:30
Mazdak13-Mar-04 18:30 
GeneralRe: DataGrid Sorting Pin
jazzle14-Mar-04 1:41
jazzle14-Mar-04 1:41 
GeneralRe: DataGrid Sorting Pin
jazzle14-Mar-04 9:52
jazzle14-Mar-04 9:52 
GeneralRe: DataGrid Sorting Pin
Mazdak14-Mar-04 9:57
Mazdak14-Mar-04 9:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.