C#读入整数

// ClassLibrary1.h
#include<iostream>
#pragma once

using namespace System;

namespace ClassLibrary1 {

    public ref class Class1
    {
        // TODO:  在此处添加此类的方法。
    public:
        static int ReadInt()
        {
            int i=0;
            std::cin >> i;
            return i;
        }
    };
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ClassLibrary1;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 0, b = 0, c = 0;
            a = Class1.ReadInt();
            b = Class1.ReadInt();
            c = a + b;
            Console.WriteLine(a.ToString() + " + " + b.ToString() +" = "+ c.ToString());
            Console.ReadKey();
        }
    }
}
原文地址:https://www.cnblogs.com/JebediahKerman/p/6104041.html