- 实验作业
1.调试分析课本每一个例题,有可能的话更改成2-3个方法的新程序;
2.编程实现课本每一个编程习题。
2.1
#include <iostream>
using namespace std;
int main()
{
int a[10],*p = a;
for(int i=0;i<10;i++)
a[i]=2*(i+1);
for(;p<a+10;p++)
cout<<*p<<" ";
cout<<endl;
return 0;
}
程序运行结果
2.2
#include <iostream>
using namespace std;
void lower(char *);
int main()
{
char str[20];
cout<<"请输入一个大写字符串:";
cin.getline(str,20);
lower(str);
cout<<"转换的字符串为:"<<str<<endl;
return 0;
}
void