Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdlib.h>
- void functionI(*char);
- void functionD(*char);
- void functionL(*char);
- void functionR(*char);
- int main(int argc, char *argv[]){
- char functioncall[10];
- char word[101];
- FILE *fp = fopen(argv[1], "r");
- fscanf(fp, "%s", word);
- fscanf(argv[2], "%s", functioncall);
- if(argc != 3){
- printf("Error");
- return 1;
- }
- while( ! feof(fp) ){
- int i;
- for(i=0; i<strlen(argv[2]); i++){
- if(functioncall == 'I')
- functionI(word);
- else if(functioncall == 'D')
- functionD(word);
- else if(functioncall == 'L')
- functionL(word);
- else if(functioncall == 'R')
- functionR(word);
- }
- sscanf(fp, "%s", word);
- }
- return 0;
- }
- void functionI(char *word){
- int i;
- for(i=0; i<strlen(word); i++)
- printf("%c", word[i]+1);
- printf("\n");
- return;
- }
- void functionD(char *word){
- int i;
- for(i=0; i<strlen(word); i++)
- printf("%c", word[i]-1);
- printf("\n");
- return;
- }
- void functionL(char *word){
- int i;
- char temp;
- temp = strlen(word);
- for(i=0; i<strlen(word); i++){
- temp = word[i];
- word[i] = word[i+1];
- temp = word[i+1];
- printf("%c", word[i]);
- }
- return;
- }
- void functionR(char *word){
- int i;
- char temp;
- temp = strlen(word);
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement