البرنامج عبارة عن لعبة تختار أسم وتعطيك حرف واحد و موقع الحرف في الأسم وأمت تكتب الأسم أذا كان الأسم الي كتبته صحيح تفوز
هذا الجواب
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication5
{
class Program
{
private static Path path = new Path();
private static Messages messages = new Messages();
static void Main(string[] args)
{
run();
Console.WriteLine(messages.msg(12));
Console.ReadKey();
}
private static void run()
{
bool runtheprogram = true;
Console.WriteLine(messages.msg(0));
Console.WriteLine(messages.msg(1));
help();
Console.WriteLine(messages.msg(9));
while (runtheprogram)
{
path.settheprogram();
Console.WriteLine(messages.msg(2),path.getnamechar());
Console.WriteLine(messages.msg(3),path.getcharnumber());
Console.WriteLine(messages.msg(4),path.getnamelenght());
Console.Write(messages.msg(5));
String userinput = Convert.ToString(Console.ReadLine());
runtheprogram = game(userinput);
answer();
}
}
private static bool game(String userinput)
{
if (userinput == "1")
{
help();
}
if (userinput == "0")
{
exit();
}
else
{
if (userinput == path.getname())
{
Console.WriteLine(messages.msg(7));
}
else
{
Console.WriteLine(messages.msg(6));
}
}
Console.WriteLine(messages.msg(11));
Console.Write(messages.msg(8));
userinput = Convert.ToString(Console.ReadLine());
Console.WriteLine("\n");
if (userinput == "y" || userinput == "Y")
return true;
if (userinput == "n" || userinput == "N")
return false;
return true;
}
private static void answer()
{
Console.WriteLine(messages.msg(13),path.getname());
}
private static void help()
{
Console.WriteLine(messages.msg(10));
}
private static void exit()
{
Environment.Exit(0);
}
}
}messages class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication5
{
class Messages
{
public String msg(int msgId)
{
switch (msgId)
{
case 0: return "Wellcom The Random Name Game";
case 1: return "I will give one letter from a hidden name and the position of the letter and the lenght of the name.";
case 2: return "This is the letter : {0}";
case 3: return "This is the position of the letter : {0}";
case 4: return "This is the lenght of the name : {0}";
case 5: return "Gusse The Name : ";
case 6: return "I win! \n";
case 7: return "You win! \n";
case 8: return "Would you like to play agian?";
case 9: return "Help = 1 - Exit = 0";
case 10: return "For example I would give "
+ "This is the letter : u \n"
+ "This is the position of the letter : 2 \n"
+ "This is the lenght of the name : 7 \n"
+ "Gusse The Name : Mustafa \n";
case 11 : return "y or Y for Yes - n or N for No";
case 12: return "Thanks A Lot For Trying The Game";
case 13: return "The answer was : {0} \n";
default: return "Program error, this program doesn't contine this further information";
}
}
}
}باقي الجواب أنا كتبت الرنامج في 2:30 س
الأسماء التي تحوية اللعبة
Dacian Carson Aric Garan Manyard Kellan Oscar Nathan Riley Tave Malik Terrian
اللعبة في المرفق