2、字0~9转换成小写字母a~j;所有小写字母转换成大写字符。然后在主函数输出转换后的字符串。
#include
#include
____void change(char*,char*)_(4)_____
void main()
{char str1[20], str2[20];
cin>>str1;
change(str1,str2);
cout<=
3、'0'&&*s1<='9')
*s2=___*s1+49__(6)_____;
else *s2=toupper(*s1);
____*s1++_(7)_____
}
*s2='\0';
}
3.函数create从键盘输入整数序列,以输入0为结束。按输入逆序建立一个以head为表头的单向链表。例如,输入序列为1 2 3 4 5 0,建立的链表是5 4 3 2 1。
struct node{int data; node * next;};
create(node * &head)
{node *p;
_ link*next___(8)____
4、
cin>>p->data;
while(p->data!=0)
{if(head==NULL)
{ head=p; head->next=NULL; }
else
{ __head=p___(9)_____
___p->next=head__(10)_____
}
p=new node;
cin>>p->data;
}
}
五.程序设计(第1小题6分,第2、3小题各7分,共20分)
1. 编写函数输出以下形状的图形,其中构成图形的符号和输出的行数通过参数传送。
#
# #
# #
#
5、 #
# # # # # # # # #
#include
void main()
{int n,i,j,m;char a;
cout<<"please input a sign.";
cin>>a;
cout<<"please input the alcohol.";
cin>>n;
for(i=1;i<=n;i++)
{if(i!=n)
{ for(j=1;j<=n-i;j++)
cout<<" ";
if(j==n-i+1) cout<6、ut<<" ";
if(j==n+i-1) cout<