第一范文网 - 专业文章范例文档资料分享平台

《c++程序设计》谭浩强课后习题答案及解析 

来源:用户分享 时间:2025/5/28 23:35:07 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

.

}

cout<<\ cout< #include using namespace std; int main() {int j;

string ch=\ cout<<\ j=0;

while (j<=ch.size())

{ if ((ch[j]>='A') && (ch[j]<='Z')) ch[j]=155-ch[j];

else if ((ch[j]>='a') && (ch[j]<='z')) ch[j]=219-ch[j]; j++; }

cout<<\ cout< #include using namespace std; int main() {int j;

string ch=\ cout<<\ j=0;

while (j<=ch.size())

{ if ((ch[j]>='A') && (ch[j]<='Z')) ch[j]=155-ch[j];

else if ((ch[j]>='a') && (ch[j]<='z')) ch[j]=219-ch[j]; j++; }

.

.

cout<<\ cout<

#include #include using namespace std; int main()

{char s1[80],s2[40]; int i=0,j=0;

cout<<\ cin>>s1;

cout<<\ cin>>s2;

while (s1[i]!='\\0') i++;

while(s2[j]!='\\0') s1[i++]=s2[j++]; s1[i]='\\0';

cout<<\ return 0; }

5.13另一解

#include using namespace std; int main()

{char s1[80],s2[40];

cout<<\ cin>>s1;

cout<<\ cin>>s2; strcat(s1,s2);

cout<<\ return 0; }

5.13另一解

#include #include using namespace std; int main()

.

.

{ string s1=\ cout<<\ cout<<\ s1=s1+s2;

cout<<\ return 0; }

5.14题

#include #include using namespace std; int main()

{ const int n=5; int i,j;

string str[n],temp;

cout<<\ for(i=0;i>str[i]; for(i=0;istr[j+1]) {temp=str[j];str[j]=str[j+1];str[j+1]=temp;} cout<

5.15题

#include #include using namespace std; int main()

{ const int n=5; string str;

for(int i=0;i

{cout<<\ cin>>str; if(str[0]=='A') cout<

.

.

}

5.16题

#include using namespace std; int main() { const n=10; int i;

char a[n],temp;

cout<<\ for(i=0;i>a[i]; for(i=0;i

{temp=a[i];a[i]=a[n-i-1];a[n-i-1]=temp;} for(i=0;i

5.16题另一解 #include #include using namespace std; int main() { string a; int i,n; char temp;

cout<<\ cin>>a; n=a.size();

for(i=0;i

{temp=a[i];a[i]=a[n-i-1];a[n-i-1]=temp;} cout<

5.17题

.

.

#include #include using namespace std; const int n=10; string name[n]; int num[n],score[n]; int main() {int i;

void input_data(); input_data();

cout<

cout<

void input_data() {int i;

for (i=0;i

{cout<<\ cin>>name[i]>>num[i]>>score[i];} }

6.1题

#include #include using namespace std; const int n=10; string name[n]; int num[n],score[n]; int main() {int i;

void input_data(); input_data();

cout<

cout<

.

《c++程序设计》谭浩强课后习题答案及解析 .doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c4tr8n37guk79ew80o94h77xpo584e200qvv_8.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top