Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

Pascal
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.

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).
Posted
Updated 22-Mar-15 2:00am
v3

1 solution

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!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900