会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Fancy Mouse
- -|||
博客园
首页
新随笔
新文章
联系
订阅
管理
TJU1028
变量就未赋值和已赋值两种状态。所谓赋值就是把一个变量的状态复制到另一个变量。仅此而已。因此用简单的模拟就可以做出。
#include
<
iostream
>
using
namespace
std;
void
Restore(
int
map[]);
int
main()
{
char
b[
3
];
int
data,lines;
int
map[
26
];
cin
>>
data;
while
(data
>
0
)
{
data
--
;
Restore(map);
cin
>>
lines;
//
Analysis the valuing
while
(lines
>
0
)
{
lines
--
;
cin
>>
b;
map[b[
0
]
-
'
a
'
]
=
map[b[
2
]
-
'
a
'
];
}
//
Output map
int
sum
=
0
;
for
(
int
temp
=
0
;temp
<
26
;temp
++
)
{
if
(map[temp])
{
if
(sum
>
0
) cout
<<
'
'
;
cout
<<
(
char
)(
'
a
'
+
temp);
sum
++
;
}
}
if
(
0
==
sum) cout
<<
"
none
"
;
cout
<<
endl;
}
return
0
;
}
void
Restore(
int
map[])
{
int
temp;
map[
0
]
=
1
;
for
(temp
=
1
;temp
<
26
;temp
++
) map[temp]
=
0
;
}
posted on
2005-09-24 01:11
Fancy Mouse
阅读(
273
) 评论(
1
)
收藏
举报
刷新页面
返回顶部