Как сделать запрос без System.Console - C#
Формулировка задачи:
Здравствуйте. Имеется консольная программа для ввода числа k и строки str. Требуется изменить ее так, чтобы она не содержала слов "System" и "Console". Как это можно сделать? Код представлен ниже.
Среда разработки - VS 2012.
Спасибо
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
int k = 0;
string str;
k = int.Parse(System.Console.ReadLine());
str = System.Console.ReadLine();
}
}
}Решение задачи: «Как сделать запрос без System.Console»
textual
Листинг программы
using System;
using System.Runtime.InteropServices;
namespace ConsoleApplication153
{
class Program
{
static void Main()
{
printf("%s" + Environment.NewLine, "Input a number");
int i;
scanf("%i", out i);
printf("Inputed: %s" + Environment.NewLine, i.ToString());
}
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern void printf(string format, string s);
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern void scanf(string format, out int value);
}
}