Helo Cprogramming members,
I am new to programming. I started lessons at c in my university and i am having trouble with an exercise.
Ok here is what exercise asks for:
"Write a program that aids with appropriate messages on the screen to read two character strings str1 and str2 even which will be given from the keyboard and then delete all the letters in the variable str1, which appear in the variable str2. The display shows the final result for checking the correct operation of the program."
For example:
string1: eleos
string2: lo
final result: e e s
Here is what i have done, but its not working properly..
Note that i can use only that libraries.
Thanks in advanceCode:#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char str1[80], str2[80]; int megethos1, megethos2,max,i,j; printf ("Give first string: "); scanf ("%s", &str1); printf ("Give second string: "); scanf ("%s", &str2); size1= strlen(str1); size2= strlen(str2); for (j=0; j<size2; j++){ for (i=0; i<size1; i++){ if (str1[i]==str2[j]) str1[i]=' '; } } printf ("%s", str1); system("pause"); }![]()



LinkBack URL
About LinkBacks



