Перевод текста из C++ в C#
Формулировка задачи:
Помогите исправить.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WindowsFormsApplication2
{
class Rational
{
long a, b;
public Rational(long ,long ); //error CS1001: Ожидались идентификаторы
public Rational(long x){b=1; a=x;}
public long getp() const {return a;} //числитель(error CS1002: ожидалась ;),(error CS1519: Недопустимая лексема ";" в объявлении класса, структуры или интерфейса),(error CS1031: Ожидался тип)
public long getq() const {return b;} //знаменатель (Ожидался класс, делегат, перечисление, интерфейс или структура),(error CS1022: Ожидалось определение типа или пространства имен, либо признак конца файла)
Rational::Rational(long x, long y){
long temp=gcd(x,y);
a=x/temp;
b=y/temp;
}
Rational & Rational:: operator +=(Rational x){
long temp=gcd(b,x.b);
a=a*(x.b/temp)+x.a*(b/temp);
b=(b*x.b)/temp;
return *this;
}
Rational & Rational:: operator -=(Rational x){
long temp=gcd(b,x.b);
a=a*(x.b/temp)-x.a*(b/temp);
b=(b*x.b)/temp;
return *this;
}
Rational & Rational::operator *=(Rational x){
long temp;
a=a*x.a;
b=b*x.b;
temp=gcd(a,b);
a=a/temp;
b=b/temp;
return *this;
}
Rational & Rational::operator /=(Rational x){
long temp;
a=a*x.b;
b=b*x.a;
temp=gcd(a,b);
a=a/temp;
b=b/temp;
return *this;
}
ostream & operator << (ostream & o, Rational x){ //вывод
return o<<x.a<<'/'<<x.b;
}
istream & operator >> (istream & i, Rational &x){ //ввод
long c, d;
i>>c>>d;
x.a=c;
x.b=d;
return i;
}
bool operator == (Rational x, Rational y){
return (x.a==y.a && x.b==y.b);
}
bool operator > (Rational x, Rational y){
x.a=x.a*y.b;
y.a=y.a*x.b;
return (x.a>y.a);
}
bool operator != (Rational x, Rational y){
return !(x==y);
}
bool operator <=(Rational x, Rational y){
return !(x>y);
}
bool operator <(Rational x, Rational y){
return (!(x>y) && !(x==y));
}
bool operator >=(Rational x, Rational y){
return (x>y || x==y);
}
bool operator ! (Rational x){
return !(x==0);
}
Rational operator + (Rational x, Rational y){
return x+=y;
}
Rational operator - (Rational x, Rational y){
return x-=y;
}
Rational operator * (Rational x, Rational y){
return x*=y;
}
Rational operator / (Rational x, Rational y){
return x/=y;
}
};
}Решение задачи: «Перевод текста из C++ в C#»
textual
Листинг программы
Form1 myForm = new Form1;