Professional Documents
Culture Documents
#include <stdio.h>
#include <string.h>
int main()
{
char s[100];
strrev(s);
return 0;
}
#include <stdio.h>
int main()
{
char name[20];
printf("Enter name: ");
scanf("%s", Resty);
printf("Your name is %s .", Resty);
return 0;
}
int main()
{
char a[100], b[100];
strcat(a,b);
return 0;
}
LEARNING MODULE SURIGAO STATE COLLEGE OF TECHNOLOGY
5. Create a program to copy one string to another using strcpy function.
#include<stdio.h>
#include<string.h>
main()
{
char source[] = "C Program";
char destination[50];
strcpy(destination, source);
printf("Source string: %s\n", source);
printf("Destination string: %s\n", destination);
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
char string[1000];
printf("Input a string to convert to upper case\n");
gets(string);
printf("The string in upper case: %s\n", strlwr(string));
return 0;
}
#include<stdio.h>
#include<string.h>
void concat(char[], char[]);
int main() {
char s1[50], s2[30];
SURIGAO
printf("\nEnter String
LEARNING MODULE 1 :"); STATE COLLEGE OF TECHNOLOGY
gets(s1);
printf("\nEnter String 2 :");
gets(s2);
concat(s1, s2);
printf("nConcated string is :%s", s1);
return (0);
}
8. Create a program using string function that would display the length of
the string.
#include <iostream>
usingname space std;
int main() {
string str = C++ programming";
return 0;
}
9. Create a program using string function that would display if the two
strings are equal/similar or not.
#include <stdio.h>
#include <string.h>
int main()
{
char a[100], b[100];
printf("Enter a string\n");
gets(a);
printf("Enter a string\n");
gets(b);
if (strcmp(a,b) == 0)
printf("The strings are equal.\n");
else
printf("The strings are not equal.\n");
return 0;
}
10. Create a program using string function that would merge your first
LEARNING MODULE SURIGAO STATE COLLEGE OF TECHNOLOGY
name to your family name.