Below is the video to you can watch and use the content below the video you can run on visual studio.
https://youtu.be/PNBB-bPsLz8
Concatenate two strings:
/* Function name: main
Description: Start of program.
Parameters: NA */
int main()
{
char user_input1[101];
char user_input2[101];
int a = 0;
/* Loops in C */
printf("\nPlease enter first string: ");
gets(user_input1);
printf("\nPlease enter second string: ");
gets(user_input2);
strcat(user_input1, " ");
strcat(user_input1, user_input2);
printf("\nOutput concatenated string is: %s\n", user_input1);
return 0;
}
String compare:
#include<stdio.h>
/* Function name: main
Description: Start of program.
Parameters: NA */
int main()
{
char user_input1[101];
char user_input2[101];
int a = 0;
/* Loops in C */
printf("\nPlease enter first string: ");
gets(user_input1);
printf("\nPlease enter second string: ");
gets(user_input2);
if (strcmp(user_input1, user_input2) == 0) {
printf("\nSuccess");
} else {
printf("\nFailure");
}
return 0;
}
String copy
#include<stdio.h>
/* Function name: main
Description: Start of program.
Parameters: NA */
int main()
{
char user_input1[101];
char user_input2[101];
int a = 0;
/* Loops in C */
printf("\nPlease enter first string: ");
gets(user_input1);
printf("\nPlease enter second string: ");
gets(user_input2);
strcpy(user_input1, user_input2);
printf("\nCopied string is: %s\n", user_input1);
return 0;
}
String length:
#include<stdio.h>
/* Function name: main
Description: Start of program.
Parameters: NA */
int main()
{
char user_input1[101];
char user_input2[101];
int a = 0;
/* Loops in C */
printf("\nPlease enter first string: ");
gets(user_input1);
printf("\Length of string is: %d\n", strlen(user_input1));
return 0;
}
https://youtu.be/PNBB-bPsLz8
Concatenate two strings:
/* Function name: main
Description: Start of program.
Parameters: NA */
int main()
{
char user_input1[101];
char user_input2[101];
int a = 0;
/* Loops in C */
printf("\nPlease enter first string: ");
gets(user_input1);
printf("\nPlease enter second string: ");
gets(user_input2);
strcat(user_input1, " ");
strcat(user_input1, user_input2);
printf("\nOutput concatenated string is: %s\n", user_input1);
return 0;
}
String compare:
#include<stdio.h>
/* Function name: main
Description: Start of program.
Parameters: NA */
int main()
{
char user_input1[101];
char user_input2[101];
int a = 0;
/* Loops in C */
printf("\nPlease enter first string: ");
gets(user_input1);
printf("\nPlease enter second string: ");
gets(user_input2);
if (strcmp(user_input1, user_input2) == 0) {
printf("\nSuccess");
} else {
printf("\nFailure");
}
return 0;
}
String copy
#include<stdio.h>
/* Function name: main
Description: Start of program.
Parameters: NA */
int main()
{
char user_input1[101];
char user_input2[101];
int a = 0;
/* Loops in C */
printf("\nPlease enter first string: ");
gets(user_input1);
printf("\nPlease enter second string: ");
gets(user_input2);
strcpy(user_input1, user_input2);
printf("\nCopied string is: %s\n", user_input1);
return 0;
}
String length:
#include<stdio.h>
/* Function name: main
Description: Start of program.
Parameters: NA */
int main()
{
char user_input1[101];
char user_input2[101];
int a = 0;
/* Loops in C */
printf("\nPlease enter first string: ");
gets(user_input1);
printf("\Length of string is: %d\n", strlen(user_input1));
return 0;
}
No comments:
Post a Comment
Feel free to suggest, comment, please follow my blog to support it.