找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 1992|回复: 2

[求助]用C++或JAVA编程一下要怎么能?--*knocker转移

[复制链接]
发表于 2009-11-2 04:25:57 | 显示全部楼层 |阅读模式 IP:江苏扬州
1 Complete the following program problems in c/c++, or if you are familiar with C# or Java you can use that as well.
a)

 做道题 谢谢::!!!
Implement a revert function which takes a string as input, on output, it reverts the characters in the input string. e.g. "Hello" becomes "olleH"
char * revert ( char * s )
{
发表于 2009-11-2 04:26:00 | 显示全部楼层 IP:江苏扬州

  1. /* 文件名:
  2. *
  3. * 功能: 实现字符串的倒序输出
  4. *
  5. * 作者: zhoujun
  6. * 时间: 2006-03-22
  7. *
  8. */
  9. #include <iostream>
  10. #include <cstdlib>
  11. #include <string>
  12. using namespace std;
  13. const int SIZE = 100;
  14. void revert(char *s);
  15. int main()
  16. {
  17. char str[SIZE];
  18. cout << "input a string:\n";
  19. cin.getline(str,SIZE);


  20. revert(str);

  21. cout << "After reverting the string it becomes " << endl
  22. << str << endl;


  23. system("PAUSE");
  24. return 0;
  25. }
  26. void revert(char *s)
  27. {
  28. char temp;
  29. for (int i=0,j=strlen(s)-1; i<j; ++i,--j)
  30. {
  31. temp = s[i];
  32. s[i] = s[j];
  33. s[j] = temp;
  34. }
  35. }
复制代码


这样行不行。
回复

使用道具 举报

发表于 2009-11-2 04:26:05 | 显示全部楼层 IP:江苏扬州
不错
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 01:42 , Processed in 0.187822 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表