怎么样定义一个可读写的全局变量,比如我代码中的变量yu
#include<iostream>
#define yu;
int day(int);
int hour(int);
int minute(int);
int second(int);
const int stom = 60;
const int mtoh = 60;
const int htod = 24;
int main(){
using namespace std;
cout << "Enter the number of seconds: ";
long seconds;
cin >> seconds;
cout << seconds << " seconds = " << day(seconds) << " days, "
<< hour(seconds) << " hours, " << minute(seconds)
<< " minutes, " << second(seconds) << " seconds." << endl;
return 0;
}
int day(int s){
int d;
d = s /stom / mtoh / htod;
return d;
}
int hour(int s){
int h;
yu = s %(stom * mtoh * htod);
h = yu / stom / mtoh;
return h;
}
int minute(int s){
int m;
yu = yu %(stom * mtoh);
m = yu / stom;
return 0;
}
int second(int s){
int se;
se = yu % stom;
return se;
}
求大神指教