Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Namespace addition
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using NameSpaceExample; namespace NameSpaceExample { class CountDown { int val; public CountDown(int n) { val = n; } public void Reset(int n) { val = n; } public int Count() { if(val > 0) return val--; else return 0; } } } namespace NameSpaceExample { class CountUp { int val; public CountUp(int n) { val = n; } public void Reset(int n) { val = n; } public int Count() { if(val<25) return val++; else return 0; } } } namespace Rextester { public class Program { public static void Main(string[] args) { // Notice how CountDown is qualified by Counter. //NameSpaceExample.CountDown cd1 = new NameSpaceExample.CountDown(10); CountDown cd1=new CountDown(10); int i; do { i = cd1.Count(); Console.Write(i + " "); } while(i > 0); Console.WriteLine(); // Again, notice how CountDown is qualified by Counter. CountUp cd2 = new CountUp(0); do { i = cd2.Count(); Console.Write(i + " "); } while(i > 0); Console.WriteLine(); cd2.Reset(4); do { i = cd2.Count(); Console.Write(i + " "); } while(i > 0); Console.WriteLine(); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
bc160401882
asdf
operator
HDEFDCSA SS0546254
c# problem
Fiddling around
MIXED CONTENT - string and numbers separation in a large string
abababa sub string
CubexSoft2
prime
Please log in to post a comment.