99问答网
所有问题
用C#编写一个程序,把字符串“helloworld”以相反顺序输出
如题所述
举报该问题
推荐答案 2008-03-10
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication50
{
class Program
{
static void Main(string[] args)
{
Program p = new Program();
string str = "hello wrold!";
Console.WriteLine(p.GetNewStr(str));
Console.ReadLine();
}
public string GetNewStr(string str)
{
string newStr="";
for (int i = 0; i < str.Length; i++)
{
newStr += str[str.Length - i - 1];
}
return newStr;
}
}
}
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://99.wendadaohang.com/zd/eX7BBeve.html
其他回答
第1个回答 2008-03-06
很简单
string str = "helloworld";
for (int i=str.Length; i > 0; i--)
{
Response.Write(str.Substring(i-1,1));
}
相似回答
用C#编写一个程序,把字符串
"HELLO WORD"
以相反顺序输出
答:
就像一楼说的那样。
string
类型
有一个
reverse函数的。但是返回类型是泛型的接口类型的。。
写一个程序把字符串
"Hello Word"
以相反顺序输出
答:
学了数组就用数组。
把Hello World 中的字节 输入到 数组变量中 然后用for循环把 数组倒着输出
。 方法一样,你看你用什么语言编写。 还有 应该是 Hello World 不是 Hello Word...
...的
字符串,将
其中的字符以与输入
相反
的
顺 序输出
。
答:
循环i++拆分 然后j--输出就可以了 这只是原理 至于
字符串
的使用可以参考这个http://zhidao.baidu.com/link?url=Qleys2ADFuk4cK4qK4JsVhd1rp8Oge2uToMuRQvPK1kBWHpo6z_57ja-YjS-90wSmyCWTmQlDEmUyDYh3B2-lq
c语言:采用递归方法实现
将
输入的
字符串
按反
序输出
答:
以下是使用递归方法实现将输入字符串按反
序输出
的 C 语言
程序
:```c include <stdio.h> // 递归函数
,将字符串
str 按反序输出 void printReverse(char *str) { if (*str == '\0') { // 判断是否到达字符串结尾 return;} else { printReverse(str + 1); // 递归调用,输出下一...
用C
语言
编写程序
:接收用户输入的
字符串,
并
以相反
的
顺序输出
该字符串
答:
scanf("%s",str); //向str数组中输入
字符串
// gets(str); //这里是另一种方法 用这种可以读入空格 len=strlen(str); //使用strlen函数 得到字符串长度 for(i=len-1;i>=0;i--)printf("%c",str[i]); //反
序输出
这里字符串长度减1 因为数组是从0开始的 printf("\n"); //换行...
用c#编写一个程序
将一个
数组逆序
输出
答:
System.Collections.Generic;using System.Linq;namespace ConsoleApplication1{ class Program { static void Main(
string
[] args) { int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; Console.WriteLine("
顺序输出
"); for (int i = 0; i < a.Length; i++...
设计
一个
C
程序,
从键盘输入n个数,在屏幕上
以相反
的
顺序
显示这些数
答:
include<stdio.h> include<
string
.h> define max 1000 void main(){ int a[max];int n;int i;for(i=1;i<=n;i++)scanf("%d",a[i]);for(i=n;i>0;i--)printf("%d",a[i]);printf("\n");}
求汇编语言
程序
:从键盘输入
一字符串
(>
1
)在下一行
以相反
次序显示出来...
答:
10 INT 21H MOV AH,2 MOV DL,13 INT 21H MOV DL,10 INT 21H LEA SI,STR1 MOV CL,[SI+1] MOV CH,0 MOV
求
一个
C语言
程序
:输入正整数,要求
以相反
数
顺序输出
该数求详解
答:
/*求一个C语言
程序
:输入正整数,要求
以相反
数
顺序输出
该数。如输入1234,输出4321.*/ include "stdio.h"void main(){ int n,m,r;printf("请输入1个正整数:");scanf("%d",&n);m=n;printf("\n正整数%d反序输出为:",n);while(m){ r=m%10;printf("%d",r);m=m/10;} } ...
大家正在搜
程序编写输出helloworld
输出helloworld的程序
编写程序helloword
编程helloworld代码
helloworld程序
c语言程序helloworld
创建helloworld程序
c语言helloworld编程
c语言输出hello world
相关问题
用C#编写一个程序,把字符串"HELLO WORD"以相反顺...
编写一个程序,将字符串s中的所有字符c删除。
写一个程序把字符串"Hello Word"以相反顺序输出
我是新手,刚刚学习C#,各位高手说下,编写一个控制台程序实现...
编写程序,把字符串“hello world”以相反的顺序输出
C#编程,接收用户输入的字符串,将其中的字符以与输入相反的顺...
编写一个采用递归算法的程序,将输入的任意一个正整数n以相反的...
在VS2008中,编写一个控制台应用程序,它接收用户输入的一...