a big problem

D

Dik T. Winter

>
> This will work with EBCDIC. It will even work, amazingly, with Baudot.
> In fact, it will even work with Morse code. When designing character
> sets, humans have a tendency to make A-Z contiguous. (Of course, for
> Baudot and Morse A-Z exists but there are no a-z).

Eh? In Baudot the coding of '-' is between 'W' and 'T'. In what you
call Baudot (but actually is Murray), ' ' is between 'O' and 'H'. It
also does not work with EBCDIC because the backslash, the closing brace,
the hook and the fork are also in that range.

So what do you mean when you say that it works?
 
F

Flash Gordon

How about this?

#include<stdio.h>

int main()
{
char scr;

printf("input the character: ");
scanf("%s", &scr);

Exactly how many characters do you think fit in to a single character?
Add to that C strings are terminated with a nul character and how long a
C string do you think fits in to a single character? In addition, the
"%s" format specifier for scanf (without limiting the length) is just as
bad as gets because it allows the user to enter a longer string than
fits in to the destination thus overwriting memory, so don't do that.
if (scr >= 'A' && scr <= 'Z')

A-Z are not guaranteed contiguous or to be in sequence. Loot up the is*
functions which are provided for a reason.
{
scr += 32;

Upper and lower case letters are not guaranteed to be separated by 32.
Look up the to* functions.
}
if (scr >= 'a'&& scr <= 'z')
{
scr -= 32;
}

printf("the result is: %s", &scr);

return 0;
}

Simple code is ok, i think.

It is simply atrocious code. You still have a *lot* to learn.
The IDE I used is Dev-C++ 4.9.9.0.

Irrelevant.
 
M

Mark McIntyre

When designing character
sets, humans have a tendency to make A-Z contiguous.

Er... What, you mean like abgdezeth ?

Thats a contiguous alphabetic sequence in the order which would make
perfect sense to millions of people.

(and lets not forget azerty....)

Mark McIntyre
 
S

slebetman

Mark said:
Er... What, you mean like abgdezeth ?

Thats a contiguous alphabetic sequence in the order which would make
perfect sense to millions of people.

(and lets not forget azerty....)

Mark McIntyre

OK, OK. Sorry I was wrong. I knew I should have checked before posting..
 
X

Xiaocao Feidao

Thank you very much! These faults knocked me back.
éžå¸¸è°¢è°¢ä½ ï¼Œæˆ‘对这些错误感动很震惊。
 
X

Xiaocao Feidao

Thank you very much! These faults knocked me back.
éžå¸¸è°¢è°¢ä½ ï¼æˆ‘对这些错误感到很震惊。
 
?

=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=

Malcolm said:
The hard part is addressing the screen. Virtually all C compilers
come with some sort of non-standard library for accessing character-
mapped screens.

What is this "screen" you speak of? I've searched through my copy of
the standard but found no mention of it.

DES
 
M

Malcolm

"Dag-Erling Smørgrav" said:
What is this "screen" you speak of? I've searched through my copy of
the standard but found no mention of it.
Raster (addressable, modifiable pixels) devices attached to computers as
output devices.

The libraries to access them are non-standard, so the standard has no need
to mention such a thing.
 
M

Mark McIntyre

Raster (addressable, modifiable pixels) devices attached to computers as
output devices.

Your sarcasm detector is broken. It seems exceptionally likely that
Dag-Erling knew this.
Mark McIntyre
 
R

Richard Heathfield

Dag-Erling Smørgrav said:
What is this "screen" you speak of?

Screen is a full-screen window manager that multiplexes a
physical terminal between several processes (typically
interactive shells). Each virtual terminal provides the
functions of a DEC VT100 terminal and, in addition, sev-
eral control functions from the ISO 6429 (ECMA 48, ANSI
X3.64) and ISO 2022 standards (e.g. insert/delete line and
support for multiple character sets). There is a scroll­-
back history buffer for each virtual terminal and a copy-
and-paste mechanism that allows moving text regions
between windows.

(From the man page.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top