| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 446 人关注过本帖
标题:求助啊~~帮我看看哪里错了~~谢谢啊
只看楼主 加入收藏
ljf1985
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-12-29
收藏
 问题点数:0 回复次数:2 
求助啊~~帮我看看哪里错了~~谢谢啊

#include <iostream>
#include <string>
using namespace std;
char chara[26][6][6]={{" * "," * * ","*****","* *","* *",},//a /*三位数组*/
{"**** ","* *","**** ","* *","**** ",},//b
{" ****","* ","* ","* "," ****",},//c
{"**** ","* *","* *","* *","**** ",},//d
{"*****","* ","**** ","* ","*****",},//e
{"*****","* ","*****","* ","* ",},//f
{" ****","* *","* **","* *"," ****",},//g
{"* *","* *","*****","* *","* *",},//h
{" *** "," * "," * "," * "," *** ",},//i
{" *"," *"," *","* *","*****",},//j
{"* *","* * ","*** ","* * ","* *",},//k
{"* ","* ","* ","* ","*****",},//l
{"* *","** **","* * *","* *","* *",},//m
{"* *","** *","* *","* * *","* *",},//n
{" *** ","* *","* *","* *"," *** ",},//o
{"**** ","* *","**** ","* ","* ",},//p
{" *** ","* *","* *","* **"," ****",},//q
{"**** ","* *","**** ","* * ","* *",},//r
{" ****","* "," ****"," *","**** ",},//s
{"*****"," * "," * "," * "," * ",},//t
{"* *","* *","* *","* *"," *** ",},//u
{"* *","* *","* *"," * * "," * ",},//v
{"* *","* * *","* * *","* * *"," * * ",},//w
{"* *"," * * "," * "," * * ","* *",},//x
{"* *","* *"," * * "," * "," * ",},//y
{"*****"," * "," * "," * ","*****",}};//z
void main()
{

char s[40]; /*定义的字符数组 */
printf("Please input words:");
gets(s); /*键盘输入字符串*/
for(int i=0;i<5;i++)
{
for(int j=0;j<strlen(s);j++) /*取输入的单词的长度*/
{
printf(chara[s[j]-'a'][i]); /*显示相应的字母对应的*和空格*/
printf(" ");
}
printf("\n");
}
}

搜索更多相关主题的帖子: include 
2005-12-29 09:42
xiaxia421
Rank: 1
等 级:新手上路
帖 子:129
专家分:0
注 册:2005-10-15
收藏
得分:0 
其中注释有错误
还有就是在c语言中的输入输出流头文件是stdio.h
iostream.h是C++中的输入输出流
using namespace std;这个命名空间可以不用
还有就是printf(chara[s[j]-'a'][i]); 格式不对!
不过我编译正确了 功能还没实现!


[fts=3][M][ftc=#F16C4D]ぃ~~è前方是绝路,希望在转角è~~ぃ[/ft][/M][/ft]
2005-12-29 11:38
xiaxia421
Rank: 1
等 级:新手上路
帖 子:129
专家分:0
注 册:2005-10-15
收藏
得分:0 

你现在看看你要的功能实现了么!

#include <string.h>
#include <iostream.h>

char chara[26][6][6]={" * "," * * ","*****","* *","* *",
"**** ","* *","**** ","* *","**** ",
" ****","* ","* ","* "," ****",
"**** ","* *","* *","* *","**** ",
"*****","* ","**** ","* ","*****",
"*****","* ","*****","* ","* ",
" ****","* *","* **","* *"," ****",
"* *","* *","*****","* *","* *",
" *** "," * "," * "," * "," *** ",
" *"," *"," *","* *","*****",
"* *","* * ","*** ","* * ","* *",
"* ","* ","* ","* ","*****",
"* *","** **","* * *","* *","* *",
"* *","** *","* *","* * *","* *",
" *** ","* *","* *","* *"," *** ",
"**** ","* *","**** ","* ","* ",
" *** ","* *","* *","* **"," ****",
"**** ","* *","**** ","* * ","* *",
" ****","* "," ****"," *","**** ",
"*****"," * "," * "," * "," * ",
"* *","* *","* *","* *"," *** ",
"* *","* *","* *"," * * "," * ",
"* *","* * *","* * *","* * *"," * * ",
"* *"," * * "," * "," * * ","* *",
"* *","* *"," * * "," * "," * ",
"*****"," * "," * "," * ","*****"};
void main()
{

char s[40];
cout<<"please input words:"<<endl;
cin>>s;
for(int i=0;i<5;i++)
{
int ss;
ss=int(strlen(s));
for(int j=0;j<ss;j++)
{
cout<<chara[s[j]-'a'][i][i]<<endl;
cout<<" ";
}
cout<<endl;
}
}

[此贴子已经被作者于2005-12-29 11:47:43编辑过]


[fts=3][M][ftc=#F16C4D]ぃ~~è前方是绝路,希望在转角è~~ぃ[/ft][/M][/ft]
2005-12-29 11:42
快速回复:求助啊~~帮我看看哪里错了~~谢谢啊
数据加载中...
 
   



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

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