| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 652 人关注过本帖
标题:[求助]用C++或JAVA编程一下要怎么能?-->knocker转移
只看楼主 加入收藏
sunkoc8yu6
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-3-21
收藏
 问题点数:0 回复次数:2 
[求助]用C++或JAVA编程一下要怎么能?-->knocker转移

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 )
{

搜索更多相关主题的帖子: knocker JAVA 
2006-03-21 09:08
sophia
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2004-9-5
收藏
得分:0 
[CODE]
/* 文件名:
*
* 功能: 实现字符串的倒序输出
*
* 作者: zhoujun
* 时间: 2006-03-22
*
*/

#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;

const int SIZE = 100;
void revert(char *s);

int main()
{
char str[SIZE];
cout << "input a string:\n";
cin.getline(str,SIZE);


revert(str);

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


system("PAUSE");
return 0;
}

void revert(char *s)
{
char temp;
for (int i=0,j=strlen(s)-1; i<j; ++i,--j)
{
temp = s[i];
s[i] = s[j];
s[j] = temp;
}

}
[/CODE]

这样行不行。

2006-03-22 13:05
sunnvya
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:1094
专家分:0
注 册:2005-11-23
收藏
得分:0 

不错


http://www. 第二站>>>提供源码下载
2006-03-23 20:39
快速回复:[求助]用C++或JAVA编程一下要怎么能?-->knocker转移
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023730 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved