mirror of
https://github.com/theoleuthardt/learningC.git
synced 2026-06-13 09:37:53 +00:00
Initial commit
This commit is contained in:
commit
826d4c8c9d
81 changed files with 7268 additions and 0 deletions
28
uebung8/aufgabe6.c
Normal file
28
uebung8/aufgabe6.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void reverseCase(char *string){
|
||||
while(*string != '\0'){
|
||||
if((unsigned char)*string < 91){ // Falls der aktuelle Buchstabe groß ist,
|
||||
*string = (char) ((unsigned char)*string + 32); // mach ihn klein!
|
||||
} else if((unsigned char)*string > 96) { // Falls der aktuelle Buchstabe klein ist,
|
||||
*string = (char) ((unsigned char)*string - 32); // mache ihn groß! (BIG WIN)
|
||||
}
|
||||
string++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
// Beispielstring:
|
||||
char string[] = "abbcccABBCCC";
|
||||
printf("Beispielstring: %s\n", string);
|
||||
|
||||
// Umkehrung der Groß- sowie Kleinbuchstaben
|
||||
reverseCase(string);
|
||||
|
||||
// Ausgabe des umgekehrten Strings
|
||||
printf("Umgekehrter String: %s\n", string);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue