Home > Net >  C # class five campaign, consider plain ticket.
C # class five campaign, consider plain ticket.

Time:11-18


Just a flat ticket, will vote again until the highest votes and print it out,
How to modify the code makes even appeared so flat ticket to print it all out

CodePudding user response:


This is part of the code above part of the code below I did modify the value of 1 to ignore

CodePudding user response:

Mainly in flat ticket will vote again how to do not vote directly to the flat vote again several to print it out

CodePudding user response:

 
The static void Main (string [] args)
{
The Random ran=new Random ();
While (true)
{
Int [] arr_banzhang=new int [5].
for (int i=0; i <30; I++)
{
Arr_banzhang [ran. Next (5)] + +;
}
Int maxpiao=arr_banzhang. Max ();
List ListHou=new List (a);
for (int i=0; i {
Console. WriteLine (" {0} to choose {1} ticket!" , I (Houxuang), arr_banzhang [I]);
If (arr_banzhang [I]==maxpiao)
{
ListHou. Add (I);
}
}
ListHou. ForEach ((int hou)=& gt;
{
Console. WriteLine (" {1} {0} students get the highest votes ticket!" , hou (Houxuang), maxpiao);
});
Console. WriteLine ();
The Console. ReadKey ();
}
}

CodePudding user response:

reference 4 floor Bridge_go response:
 
The static void Main (string [] args)
{
The Random ran=new Random ();
While (true)
{
Int [] arr_banzhang=new int [5].
for (int i=0; i <30; I++)
{
Arr_banzhang [ran. Next (5)] + +;
}
Int maxpiao=arr_banzhang. Max ();
List ListHou=new List (a);
for (int i=0; i {
Console. WriteLine (" {0} to choose {1} ticket!" , I (Houxuang), arr_banzhang [I]);
If (arr_banzhang [I]==maxpiao)
{
ListHou. Add (I);
}
}
ListHou. ForEach ((int hou)=& gt;
{
Console. WriteLine (" {1} {0} students get the highest votes ticket!" , hou (Houxuang), maxpiao);
});
Console. WriteLine ();
The Console. ReadKey ();
}
}

Small dormitory surveillance cameras
  •  Tags:  
  • C#
  • Related