Posts

Showing posts from April, 2022

Day vs Dates

  #include <iostream> using namespace std ; int main () {     int d1, m1, y1, d2, m2, y2, days = 0 ;     cout << "Enter the date in the format DD MM YYYY to DD MM YYYY :" ;     cin >> d1 >> m1 >> y1;     cout << " -> " ;     cin >> d2 >> m2 >> y2;     int arr1[] = { 0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 };     // int arr2[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};     int year = 0 , month = 0 ;     if ((y2 + m2) > (y1 + m1))     {         year = (y2 - y1);     }     else     {         year = 0 ;     }     if ((m2 - m1) != 0 )     {         days = arr1 [m1] - d1 + d2;     }     else     {         days = d2 - d1; ...

Integer To Roman Converter Upto 10,000.

  #include <iostream> using namespace std ; int main () {     string arr1 []={ " " , "I" , "II" , "III" , "IV" , "V" , "VI" , "VII" , "VIII" , "IX" };     string arr2 []={ " " , "X" , "XX" , "XXX" , "XL" , "L" , "LX" , "LXX" , "LXXX" , "XC" , "C" };     string arr3 []={ " " , "C" , "CC" , "CCC" , "CD" , "D" , "DC" , "DCC" , "DCCC" , "CM" , "M" };     string arr4 []={ " " , "M" , "MM" , "MMM" , "IV̅" , "V̅" , "V̅M" , "V̅MM" , "V̅MMM" , "V̅MMMM" , "X̅" };     int n ;     cin >> n ;     cout << arr4 [ n / 1000 ] << arr3 [( n % 1000 )/ ...

Amount Vs Word

  #include <iostream> #include <cstring> using namespace std ; void Amount_Word ( int amt ) {     string arr1 [] = { "zero" , "one" , "two" , "three" , "four" , "five" , "six" , "seven" , "eight" , "nine" , "ten" , "eleveen" , "twelve" , "thirteen" , "fourteen" , "fifteen" , "sixteen" , "seventeen" , "eighteen" , "nineteen" , "twenty" };     string arr2 [] = { "ten" , "twenty" , "thirty" , "fourty" , "fifty" , "sixty" , "seventy" , "eighty" , "ninety" };     // For Amount less than 100     if ( amt < 100 )     {         if ( amt <= 20 )         {             cout << arr1 [ amt ] << " " ;         }         else if ( amt >= 21 &...