Question:
how do I create a c program that?
Rian G
2014-02-16 02:35:03 UTC
that reads data from standard input one character at a time and output the results to standard output.
1. replace characters '_' '/ ' ':' ' ? ' ' &' and ' ' with its corresponding ascii code

2. Interchange the case of the alphabetical letters.

3. delete non_ascii characters.
Three answers:
2014-02-16 05:30:30 UTC
Hi,



The following should give you an idea of char to ascii conversions.



unsigned char ch;

ch = getchar();

printf("%c - %d", ch, ch );
?
2014-02-16 16:54:14 UTC
replace characters '_' '/ ' ':' ' ? ' ' &' and ' ' with the ascii code



int ch; // int 'cause getchar() returns an int (so it can hold EOF)

ch=getchar();

if(ch>127) printf("not ASCII/n");

if(ch=='_' || ch=='/' || ch== ';' || ch=='?' || ch=='&' || ch=='?')

printf("%d",ch);// print its decimal value

else

printf("%c",ch);// print it as a character glyph
?
2014-02-16 10:47:39 UTC
1.learn to code

2.make program

3.????

4.PROFIT!


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...