Untitled

 avatar
unknown
plain_text
3 years ago
943 B
4
Indexable
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
using namespace std;
struct tim{
	int h;
	int m;
	int s;
};



int main()
{

	int s0,s1,r;
	setlocale(LC_ALL, "Russian"); 
	cout << "введите часы, миуты и секунды";
	tim time1;
	cin >> time1.h >> time1.m >> time1.s;
	tim time2;
	cin >> time2.h >> time2.m >> time2.s;
	tim time3;
	time3.h = time1.h-time2.h;
	time3.m = time1.m - time2.m;
	time3.s = time1.s - time2.s;
	s0 = time1.h * 3600 + time1.m * 60 + time1.s;
	s1 = time2.h * 3600 + time2.m * 60 + time2.s;
	r = s0 - s1;

	cout << "Время 1 в секундах = " << s0 << "c" << '\n';
	cout << "Время 2 в секундах = " << s1 << "c" << '\n';

	cout << "их разность в секундах = " << r<<'\n';
	cout << "их разнось : "<<time3.h <<"часов " << time3.m <<"минут " << time3.s<<"секунд";
	



}
	
Editor is loading...