|
|
DataMuseum.dkPresents historical artifacts from the history of: Bogika Butler |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Bogika Butler Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1664 (0x680)
Types: TextFile
Names: »SAMP.C«
└─⟦d3d1d07f5⟧ Bits:30009789/_.ft.Ibm2.50006621.imd Mogens Pelles Zilog 80,000 / EOS projekt
└─⟦this⟧ »SAMP.C«
#include "auxfn.h"
main()
æ
char ch, instringÆ80Å;
char secstrÆ80Å;
puts("ØnSample program #1 : the string and characater functionsØn");
puts("Øn The following functions will be demonstrated:ØnØn");
puts(" toup tolower isalpha isdigitØn");
puts(" gets puts strcpy strcatØn");
puts(" strcmp isupper islowerØn");
puts("ØnØnEnter a string: ");
gets(instring);
puts("Here is the string you entered: ");
puts(instring);
puts("ØnHere is the string reversed: ");
reverse(instring);
puts(instring);
reverse(instring); /* put it back */
puts("Øn");
puts("Enter a second string to compare with the firstØn");
puts(": ");
gets(secstr);
if(!strcmp(secstr,instring)) puts("strings are equalØn");
else puts("strings differØn");
puts("ØnNow let's put the first string together with the secondØn");
strcat(instring,secstr);
puts(instring);
puts("ØnØnNext lets copy the second string into the first:Øn");
strcpy(instring,secstr);
puts(instring);
puts("ØnØn");
puts("Next we will demonstrate the character commandsØn");
doæ
puts("Øntype a 0 to move on: ");
ch=getchar();
if(islower(ch))
dolower(ch);
else if(isupper(ch))
doupper(ch);
else if(isdigit(ch))
dodigit(ch);
if(isalpha(ch)) puts(" character is alpha");
å while (ch!='0');
å
dolower(ch)
char ch;
æ
puts(" lower case char --> upper: ");
ch=toup(ch);
putchar(ch);
å
doupper(ch)
char ch;
æ
puts(" upper case char --> lower: ");
ch=tolower(ch);
putchar(ch);
å
dodigit(ch)
char ch;
æ
int tt;
puts(" squared is ");
tt=ch-'0';
tt=tt*tt;
putnum(tt);
å