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