Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

WON'T YOU JOIN US?
You are not a registered member and
are viewing this site as a guest.
Registration is simple and FREE.
Join this CrowdGather community today.
Registration offers the following perks:

» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging

join

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old December 1st, 2009, 10:15   #1
raksmey1309
បងស្រលាញ់អូន!
 
raksmey1309's Avatar
 
Join Date: Jul 2005
Location: ព្រះរាជាណាចក្រកម្ពុជា
Posts: 4,117
Post the code written by you thread. :D

After i learn C# for two weeks here is my first try.
What it do is: it ask 1+2=?
if you answer 3 it gives "Congrategulation you are right"
if not it ask you to continue:Y or N
if press Y it return to 1+2=? again
if you press other later than Y and N it return to Y or N.



Code:
char b;
            int a;
            begin:
            Console.WriteLine("1+2=?");
            a=Int32.Parse(Console.ReadLine());
            switch (a)
            {case 3:
                    Console.WriteLine("Congrategulation you are right");break;
                default:
                    Console.WriteLine("wrong");break;}
       
            Console.WriteLine("Y or N");

            b=char.Parse(Console.ReadLine());
  continue1:           
            switch(b)
            {case 'Y':
            goto begin;
            
                case 'N':
            Console.WriteLine("bye"); break;

               
                
                default:

goto continue1;
                   
                    break;
                Console.WriteLine("Only Y and N is inputed");
}
raksmey1309 is offline   Reply With Quote

Advertisement [Remove Advertisement]
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 14:35.

© 2006 - 2012 Emu Forums | About Emu Forums | Advertisers | Investors | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.