设为首页收藏本站

八达网

 找回密码
 注册
查看: 65|回复: 5
打印 上一主题 下一主题

好玩的东西~~

[复制链接]

101

主题

2

好友

5万

积分

光明执政官

[SvS]Heroes

战队
[SvS]
联赛ID
PY_Shmily
种族
Protoss

2010水友赛冠军 2009年度八达十大杰出青年

跳转到指定楼层
1
发表于 2007-11-15 11:01 |只看该作者 |倒序浏览
#include<iostream>
#include<string.h>
using        namespace        std;
void        main()
{
        char        M[80];
        int i,j;
        cout<<"请输入字符串:";
        cin.getline(M,80,'\n');
        j=strlen(M);
        cout<<"该字符串反序输出结果为:"<<endl;
        for(i=j-1;i>=0;i--)
        {
                cout<<M;
        }
        cout<<endl;
}



奇怪  为什么发出来会变样  我cout的是M [ i ]啊

[ 本帖最后由 诸葛亮 于 2007-11-15 11:24 编辑 ]

46

主题

0

好友

7万

积分

主区版主

处是一种生活态度

Rank: 8Rank: 8Rank: 8Rank: 8

2006年度八达十大杰出青年 2007年度八达十大水友

2
发表于 2007-11-15 11:07 |只看该作者
It's the best day of times,it's the worst day of times;

it was the age of wisdom,it was the age of foolishness;

it was the epoch of belief,it was the epoch of incredulity;

it was the season of light,it was the season of darkness;

it was the spring of hope,it was the winter of  despair;

we had everything before us,we had nothing before us;

we were all going direct to Heaven,we were all going direct the other way.
回复

使用道具 举报

101

主题

2

好友

5万

积分

光明执政官

[SvS]Heroes

战队
[SvS]
联赛ID
PY_Shmily
种族
Protoss

2010水友赛冠军 2009年度八达十大杰出青年

3
发表于 2007-11-15 11:09 |只看该作者
#include<iostream>
#include<string.h>
using        namespace        std;
void        main()
{
        char        str[80];
        int i,num=0,word=0;
        char        c;
        cout<<"请输入一行字符串:"<<endl;
        gets(str);
        for(i=0;(c=str)!='\0';i++)
        {
                if(c==' ')        word=0;
                else        if(word==0)
                {
                        word=1;num++;
                }
        }
        cout<<"您输入的一巷字符串有"<<num<<"个单词。"<<endl;
}

刚又设计了一个..
回复

使用道具 举报

2

主题

0

好友

3万

积分

大和

你看我不到看我不到

4
发表于 2007-11-15 11:10 |只看该作者
回复

使用道具 举报

101

主题

2

好友

5万

积分

光明执政官

[SvS]Heroes

战队
[SvS]
联赛ID
PY_Shmily
种族
Protoss

2010水友赛冠军 2009年度八达十大杰出青年

5
发表于 2007-11-15 11:13 |只看该作者
原帖由 dbcws 于 2007-11-15 11:10 发表



上大学一个月后学习到的东西
回复

使用道具 举报

253

主题

12

好友

11万

积分

黑暗执政官

图样图森破

战队
SCI
种族
Terran
6
发表于 2007-11-15 11:18 |只看该作者
标准的C++。
回复

使用道具 举报

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

手机版|Archiver|八达网    

GMT+8, 2026-2-23 06:16

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部