实验结论

编程练习(1)源代码

#include<iostream>
using namespace std;
int main()
{
	cout<<"Please enter 1~7"<<endl;
	int a;
	cin>>a;
	if(a>0&&a<6)
		cout<<"workday.Let's work hard.";
	else
		cout<<"weekend.Let's have a rest.";
	return 0;
}

运行结果截图

编程练习(2)源代码

#include<iostream>
using namespace std;
int main()
{
	int num,m,newnum=0;
	cout<<"Please enter the number"<<endl;
	cin>>num;
	for(;num;num/=10)
		m=num%10,newnum=newnum*10+m;
	cout<<newnum;
	return 0;
}

运行结果截图

实验总结与体会

这次实验感觉算是对C语言的一次简单的复习回顾,由于对C语言的掌握还算不错,所以在实验过程中算是顺利,没有什么大的问题。只是感觉自己写的代码不够灵活,比如循环语句,即使使用do...while语句相对简单的情况下我依然会用for语句写,原因大概就是自己懒,只想记住一种语句。另外的问题就是觉得自己打代码的速度不够快,而且经常打错字,貌似除了多打打代码也没什么好的解决办法了

 posted on 2018-03-13 19:33  梦里梦着梦不出的梦  阅读(107)  评论(1)    收藏  举报