#冠翔訓練1101 ## 1102-1  ```cpp= #include<bits/stdc++.h> using namespace std; int main(){ int n,db; cout<<"請輸入位置: "; while(cin>>n) { if(n>0) { cout<<"DAY: "; cout<<n*2-1<<"\n"; } else{ cout<<"DAY: "; db=n*-2; cout<<db<<"\n"; } cout<<"請輸入位置: "; } return 0; } ``` ## 1102-2  ```cpp= #include<bits/stdc++.h> using namespace std; int main(){ int hi, mi, hf, mf, H, M; cout<<"輸入起始時間"; cin >> hi >> mi; cout<<"輸入結束時間"; cin >> hf >> mf; H = hf-hi; M = mf-mi; if (M<0) { H-=1; M+=60; } cout<<"校長站了"<<H<<"小時"<<M<<"分"<<"\n"; return 0; } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up