C – Guess the secret sentence character by character

Here you will get complete source code guessing a character in a secret sentence or word in C Programming language. you can set your secret message or sentence in the code and then you can tell your friend to start guessing that secret message after executing the code.

One of my Facebook Page’s fan Faster Msr posted this on my page, so I coded to implement this using C Programming language.

Guess the word
Guess the word (“C Lover” at back-end).
Guess the word
Guess the word (Guessed it!).
Source Code of Program.

 

C program for all number conversion.

I have created a C program for all number conversion, its a small application using C language. I have used printf’s various format specifiers to minimize the code and utilizing the available features of printf function.

These are some of format specifiers used in the code.
  • %d => for signed decimal integer.
  • %o => unsigned octal integer.
  • %X => unsigned hexadecimal integer.
The number conversions supported by this code are listed below.
  • Binary to Octal
  • Binary to Decimal
  • Binary to Hexadecimal
  • Octal to Binary
  • Octal to Decimal
  • Octal to Hexadecimal
  • Decimal to Binary
  • Decimal to Octal
  • Decimal to Hexadecimal
  • Hexadecimal to Binary
  • Hexadecimal to Octal
  • Hexadecimal to Decimal

C program for all number conversion
All Number Conversions using C

Pyramid using C with a new logic.

There are many ways of solving a programming problem , and every one has his own logic to solve a problem. Here I also implemented a new logic using C language’s printf() function.
printf() function is more than just writing output to the screen i.e. it returns the number of characters it writes on the output screen.

One functionality of printf() is as follows.

printf(“Hello”+1); = ello
printf(“ABCDE”+2); = CDE
It skips the first n characters if we are using printf(“message”+n);

Another functionality of printf method is :

If we write =>  int num = printf(“Hello”); . Then num will have value 5 (Hello has 5 letters).

Similarly if we write,

int num = printf(“2017”);. Then num will have value 4 (2017 has 4 characters).

Pyramid Using C
Pyramid Using C

 

Love and Friendship calculator using C/C++

Love and Friendship calculator is a small C or C++ application which implements a school-time logic. When we are in school time we play with our names and calculate some percentage. I also implemented one of them logic to calculate Love and friendship.

Love and Friendship calculator

The Logic which i have implemented is as follows.

Logic
Logic Behind It
  • Two names n1 and n2 are taken from the user. And one choice for friendship or love calculation.
  • If  user choose friendship then we make a string n1+ friend + n2.
  • If user choose love then we make a string n1 + love + n2.
  • Then we start manipulation over the concatenated string from left to right.
  • We count occurrence of each character (except space) until all characters are traversed and keep that count of each character in an array.
  • Now we have an array containing count of each character. now we perform operation on this array.
  • we start adding first element of array with last element of array, second element with second last element of the array and so on.
  • Keep continue the above step until we get array with only two elements.
  • Now we have percentage. if percentage is higher then 100% we manipulate it until we get percentage less than  or equal to 100%.

Number to word converter program using C.

Number to Word Converter is a small program to show numbers in their word form. In many systems, numerical data needs to be represented into the words. We can take example of cheques the amount is written in both digits(numerical) and words. This program is created in purely C language, Basically it takes input in number and then show its word form.

Some Examples are as follows :
  • 799 = Seven Hundred Ninety Nine.
  • 1009 = One Thousand Nine.
  • 0018 = Eighteen.

Number To Word Converter
Screenshot of program