这在C ++中看起来如何 [英] How this looks in C++
本文介绍了这在C ++中看起来如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是C ++的新手,之前我使用的是Pascal。所以,我在Pascal中做了这个练习,我对它在C ++中的外观感兴趣。我只知道C ++中的基本内容:数组,循环内容等。这是Pascal代码:
I'm new to C++, previously I used Pascal. So, I did this exercise in Pascal and I'm interested in the way how this looks in C++. I only know the basic things in C++: arrays, loop stuff etc. Here's the Pascal code:
program asd;
uses crt;
var
letters: set of 'A'..'Z';
kar: char;
Begin
clrscr;
letters:=[];
while kar <> #27 do begin
if keypressed then begin
kar:=readkey;
if kar=#0 then begin
kar:=readkey;
kar:=#0;
end;
kar:=upcase(kar);
writeln(kar);
if kar in ['A'..'Z'] then
letters:=letters+[kar];
end;
end;
write('read letters from keyboard: ');
for kar:='A' to 'Z' do begin
if kar in betuk then
write(kar);
end;
writeln;
write('not read letters from keyboard: ');
for kar:='A' to 'Z' do begin
if not(kar in letters) then write(kar);
end;
readln;
end.
它从键盘读取字符,直到我按ESC,然后写出字符并且人物留在了ABC。 (抱歉我的英文不好,不是我的母语)。
It reads characters from keyboard until I press ESC, and write out the characters and the characters remained in the ABC. (Sorry for my bad English, it isn't my native language).
推荐答案
所以用C ++编写代码并试用。
我们很乐意批评你做了什么,但我们不会为你转换它!
So code it up in C++ and try it out.
We'll happily criticise what you did, but we aren't going to convert it for you!
这篇关于这在C ++中看起来如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文