Posts

Showing posts from December, 2020

Family Budget project in C++

Image
Project in C++  Code: #include <iostream> #include <cmath> using namespace std; int main() {     double x, y, size=10;     string message("I LOVE PROGRAMMING ");     int print_line = 4;     if (message.length() % 2 != 0) message += " ";     for (x=0;x<size;x++)      {             for (y=0;y<=4*size;y++)            {             double dist1 = sqrt( pow(x-size,2) + pow(y-size,2) );             double dist2 = sqrt( pow(x-size,2) + pow(y-3*size,2) );             if (dist1 < size + 0.5 || dist2 < size + 0.5 ) {                 cout << "V";             }             else cout << " ";         }        ...

C++ PROGRAM TO PRINT HEART (SHAPES)

Image
PROGRAM IN C++ TO PRINT HEART WITH A STRING MESSAGE  CODE: #include <iostream>     #include <cmath> using namespace std; int main() {     double x, y, size=10;                      string message("I LOVE PROGRAMMING ");     int print_line = 4;     if (message.length() % 2 != 0) message += " ";     for (x=0;x<size;x++)      {             for (y=0;y<=4*size;y++)            {             double dist1 = sqrt( pow(x-size,2) + pow(y-size,2) );             double dist2 = sqrt( pow(x-size,2) + pow(y-3*size,2) );             if (dist1 < size + 0.5 || dist2 < size + 0.5 ) {                 cout << "V";             } ...

C++ Program to take a square of an integer value:

Image
C++ Program to  square a number: Code: #include <iostream>           //include libraries using namespace std; int main() {     int i=1,j=0,k=0;                               // defining numerical variable value     cout<<"enter value:";     while(i<=20)                // using while loop to execute the same block of code until condition is met     {     cin>>j;     k=j*j;                                  i++;                              // it mean increment     cout<<"square of enter number is="<<k;                      ...

C++ Program to Swap two numbers

Image
 C++ Program to Swap two numbers: Algorithm: START Var1, Var2, Temp Step 1 Copy value of Var1 to Temp Step 2 Copy value of Var2 to Var1 Step 3 Copy value of Temp to Var2 STOP Code: #include<iostream>           //include libraries using namespace std; int main() {     int a,b;                            // take 2 var     cout<<"before swapping"<<endl;            //display values before swap cout<<"a ="; cin>>a; cout<<"b ="; cin>>b; a=a+b;                                        //procedure to swap b=a-b; a=a-b; cout<<"After swapping";               //display values after swap cout<<"a="<<a<<endl; cout<<"b=...

C++ Program to find an alphabet is vowel or a Consonant:

Image
                                                                     C++ Program to find an alphabet is vowel or a Consonant: Basic Information: There are 26 alphabets in our English language. Out of which, 21 are consonants and five are vowels. The five vowels are A,E,I,O,U.          FOR ANY QUERY FEEL FREE TO ASK IN COMMENT SECTION.     Basic Algorithm: Code: OUTPUT: