Compare commits
No commits in common. "main" and "upstream" have entirely different histories.
@ -19,32 +19,3 @@
|
||||
* Die folgende Ausgabe ist richtig, weil das Zeichen 3 ein Buchstabe ist: 0 *
|
||||
* Der Buchstabe 3 ist der -13. Buchstabe im Alphabet. *
|
||||
*****************************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "myio.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned char character = 'a';
|
||||
|
||||
while(character != '\n')
|
||||
{
|
||||
unsigned char lowerChar;
|
||||
|
||||
printf("Eingabe einzelnes Zeichen: ");
|
||||
character = getSingleChar();
|
||||
|
||||
lowerChar = tolower(character);
|
||||
|
||||
if(lowerChar >= 'a' && lowerChar <= 'z')
|
||||
{
|
||||
unsigned int alphaPos = lowerChar - 'a' + 1;
|
||||
printf("Der Buchstabe %c liegt an %u. Stelle im Alphabet.\n", character, alphaPos);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
12
02/myio.c
12
02/myio.c
@ -1,12 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include "myio.h"
|
||||
|
||||
unsigned char getSingleChar()
|
||||
{
|
||||
unsigned char result = 'a';
|
||||
|
||||
result = getchar();
|
||||
while(result != '\n' && getchar() != '\n') {}
|
||||
|
||||
return result;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user