chenxie95 / SJTU_C-_Cource

上交2022小学期 程序设计思想 答疑论坛
1 stars 0 forks source link

课程答疑板块 #1

Open chenxie95 opened 2 years ago

chenxie95 commented 2 years ago

大家有关于课程或代码的问题,可以在这个板块下发布新的板块,我们看到后会尽快回复

swineer commented 2 years ago

VScode配置环境问题

WeChat 圖片_20220621155555

出现错误

chenxie95 commented 2 years ago

VScode配置环境问题 WeChat 圖片_20220621155555 出现错误

这个问题解决了么? 如果windows上的话,需要讲extension中的C/C++的版本,降级到1.8.4 具体可以参考如下哔哩哔哩的链接。

https://www.bilibili.com/video/BV1Cu411y7vT?p=1&share_medium=ipad&share_plat=ios&share_source=WEIXIN&share_tag=s_i&timestamp=1655797850&unique_k=gRvl694&share_times=1

dnaht commented 2 years ago

设计的x=1+11+111+1111变成了10+21+29+38,不知道哪儿出错了 image

sjtuzyy commented 2 years ago

在codeblocks上能运行,在ice上报错 错误说明:error: variable or field ‘settime’ declared void error: ‘t1’ was not declared in this scope settime(t1) ; settime(t2) ;

include

using namespace std;

struct time { int hour ; int minute ; int second ; };

void settime(time &t) { cin >> t.hour >> t.minute >> t.second ; }

void increase(time *t) { if(t->second!=59) t->second += 1 ; else { t->second = 0 ; if (t->minute!=59) t->minute += 1 ; else { t->minute = 0 ; if(t->hour!=23) t->hour += 1 ; else t->hour = 0 ; } } }

void showtime(time t) { if(t.hour<10) cout << 0 << t.hour << ":" ; if(t.hour>=10) cout << t.hour << ":" ; if(t.minute<10) cout << 0 << t.minute << ":" ; if(t.minute>=10) cout << t.minute << ":" ; if(t.second<10) cout << 0 << t.second ; if(t.second>=10) cout << t.second ; }

int main() { time t1 , t2 ;

settime(t1) ; settime(t2) ; showtime(t1) ; cout << endl ; increase(&t1) ; showtime(t1) ; cout << endl ; showtime(t2) ; cout << endl ; increase(&t2) ; showtime(t2) ; cout << endl ;

return 0; }