Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- void myreadline(char x[200]){
- fgets(x,200,stdin);
- }
- int mystrlen( char x[40] ) {
- int i;
- for( i = 0; x[i] != '\0'; i++ );
- return i-1;
- }
- int mystrcpy( char a[], char b[] ) {
- int i =0;
- do{
- b[i]=a[i];
- i++;
- } while(a[i-1]!='\0');
- return i-2;
- }
- int mystrcmp( char a[], char b[]){
- int i,j;
- for(i=0; a[i]!='\0';i++){
- for(j=0;b[i]!='\0';j++){
- { if(a[i]==b[j])
- return 1;
- }
- if(a[i]!=b[j])
- return 0;
- }
- }
- }
- int mysubstring(char glavni[], char sporedni[]){
- int i,j;
- for(i=0;glavni[i]!='\0';i++){
- for(j=0;sporedni[j]!='\0';j++)
- {
- if(glavni[i+j]!=sporedni[j])
- break;
- if(j==mystrlen(sporedni)-1)
- return i;
- }
- }
- return (-1);
- }
- void mytoupper(char str[])
- { int i;
- for(i=0;str[i]!='\0';i++){
- if((str[i]>=97)&&(str[i]<=122))
- str[i]=str[i]-32;
- }
- }
- void mytolower(char str[])
- { int i;
- for(i=0;str[i]!='\0';i++){
- if((str[i]>=65)&&(str[i]<=90))
- str[i]=str[i]+32;
- }
- }
- void myinvertcase(char str[]){
- int i;
- for(i=0;str[i]!='\0';i++){
- if((str[i]>=97)&&(str[i]<=122))
- str[i]=str[i]-32;
- else if((str[i]>=65)&&(str[i]<=90))
- str[i]=str[i]+32;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement