30/09/2018, 19:19 
               
            Cho em hỏi đoạn code c++ sau sai ở đâu ạ
#include<iostream>
using namespace std;
class time{
	int h;
	int m;
	int s;
	public:
		time ( ){
			h=1;
			m=1;
			s=1;
		}
	void nhap();
	void xuat();
	friend time operator+(time a, time b);
	friend time operator-(time a, time b);
};
void time::nhap(){
	do{
		cout<<"nhap HH:MM:SS";
		cin>>h>>m>>s;
	}
	while(0<h||h>23||m>59||m<0||s>59||s<0);
}
void time::xuat(){
	cout<<h<<":"<<m<<":"<<s;
}
time operator+(time a, time b)
{
	time c;
	int n= 3600*a.h+60*a.m+a.s+3600*b.h+60*b.m+b.s;
	c.h=n/3600;
	c.m=(n%3600)/60;
	c.s=(n%3600)%60;
	return c;	
}
main()
{
	time a, b,c;
	a.nhap();
	b.nhap();
	c=a+b;
	c.xuat();
}
em ngồi mò mãi mà k thấy sai ở đâu cả
            Bài liên quan
         
                
            




có báo lỗi j ko bạn?
bạn đổi tên class đi là hết lỗi nhé
ờ đúng oy tks bác nhé