C++谁帮我试试这题 是不是我的编译器有问题

来源:百度知道 编辑:UC知道 时间:2024/06/23 14:02:31
#include<iostream>
using namespace std;
class Money
{
public:
friend Money operator +(Money& amount1,Money& amount2);

Money(long doallars,int cents);

void get_write();
private:
long all_cents;
};

int main()
{
Money cost(1,50),tax(0,15),total;
total=cost+tax;
total.write();
return 0;
}

Money::money(long dollars,int cents)
{
all_cents=100*dollars+cents;
}
Money operator +(Money& amount1,Money& amount2)
{
Money temp;
temp.all_cents=amount1.get_write()+amount2.get_write();
return temp;
}
void Money::write()
{
cout<<all_cents;
}
void Money::get_write()
{
return all_cents;
}
:\microsoft visual studio\myprojects\试错题1\lihui.cpp(6) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)

#include<iostream>
using namespace std;
class Money
{
public:
friend Money operator +(Money& amount1,Money& amount2);

Money(long doallars,long cents);
Money()
{}
long get_write();
void write();
private:
long all_cents;
};

int main()
{
Money cost(1L,50L),tax(0L,15L),total;
total=cost+tax;
total.write();
return 0;
}

Money::Money(long dollars,long cents)
{
all_cents=100L*dollars+cents;
}
Money operator +(Money& amount1,Money& amount2)
{
Money temp;
temp.all_cents=amount1.get_write()+amount2.get_write();
return temp;
}
void Money::write()
{
cout<<all_cents;
}
long Money::get_write()
{
return all_cents;
}

#include<iostream>
using namespace std;
class Money
{
public:
friend Money operator +(Money&