October 2, 2017

C program to use string functions | Compare, concat, copy

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;
}

September 21, 2017

C programming language | Using IF conditions and FOR/WHILE/DO-WHILE loops

Hey guys, here is another video of the C tutorial series, covered the IF conditions for loops, while loops and do while loops.
I know I am going very fast in the video, but this is all I can do in 10 minutes, I am trying not to split the video into more pieces.
Let me know how this looks by commenting below.



 

April 20, 2013

The best phone debate Q1, Q2 2013 Samsung Galaxy S4 and HTC One

Well I have been seeing several fights among user, for the best phone out there, the main fight is between Samsung Galaxy S4 and the HTC One, according to me it is down to you personal choice. Both of them have their advantages and disadvantages, where HTC One looks flawless, there S4 looks extreme. I would recommend stick to the brand you have used, if you are happy with your old Samsung phone and need an upgrade then go for S4, for anything else and HTC owners One is the way to go. There is lot of confusion among high end user for what to buy as Note III is also coming out. In this age of technology waiting is never an option, you should always get what is available in the market, because till you wait for the new technology another new technology announces itself and you are left nowhere. So I would say go for what you feel to get. Don't go for the large specification or the megapixels or the cores.