Responsive Homepage design with Bootstrap 4 and Animate css

C++ Program for Single Dimensional Array

 
#include<iostream>
using namespace std;
int main()
{
int arr[5];
int i;
for(i=0;i<5;i++)
{
cout<< “ Enter the array elements ”;
cin>>arr[i];
}
cout<<"\n Printing elements of array”);
for(i=0;i<5;i++)
{
cout<< arr[i];
}
        return 0;
}
    

C++ Program for Calculate Average of Numbers Using Arrays.

 
#include<iostream>
using namespace std;
int main() {
    int i, count, sum, arr[500];
    float average;
 
    cout << "Enter number of elements\n";
    cin >> count;
     
    cout << "Enter " << count << " elements\n";
    // Read "count" elements from user
    for(i = 0; i < count; i++) {
        cin >> arr[i];
    }
     
    sum = 0;
    // Find sum of all array elements
    for(i = 0; i < count; i++) {
        sum += arr[i];
    }
 
    average = (float)sum / count;
    cout << "Average = " << average;
 
    return 0;
}
    

C++ Program to Add Two Matrix Using Multi-dimensional Arrays.

 
#include<iostream>
using namespace std;
int main()
{
inta[2] [2], b[2] [2], i, j;
cout<< “Enter the elements of A matrix \n”;
for (i=0; i< 2; i++)
{
for (j = 0; j <2; j++)
{
cout<< "Enter the numbers";
cin>> a[i][j];
}
}
cout<< “ Enter the elements of B matrix \n”;
for (i=0; i< 2; i++)
{
for (j = 0; j <2; j++)
{
cout<<"Enter the numbers";
cin>> b[i][j];
}
}
cout<< "Addition of A and B Matrix \n”;
for (i=0; 1<2; i++)
{
 for(j=0; j <2; j++)
{
cout<< a[i][j] + b[i][j] << endl;
}
}
return 0;
} 
    

C++ Program to Find the Length of a String

 
#include<iostream>
#include<string.h>
using namespace std;
int main ()
{
    char str[50];
    int len;
    cout << "Enter an array or string : ";
    gets(str);
    len = strlen(str);
    cout << "Length of the string is : " << len;
    return 0;
}
    

C++ Program to Concatenate Two Strings.

 
#include<iostream>
#include<string.h>
using namespace std;
int main() 
{   
    char str1[100] = "Journal";
    char str2[100]= "Dev";
    
     
    cout<<"Concatenated String:"<

C++ Program to Find the Number of Vowels, Consonants, Digits and White Spaces in a String.

 
#include<iostream>
using namespace std;
int main() {
   char str[] = {"jpwebdevelopers 123"};
   int vowels, consonants, digits, spaces;
   vowels = consonants = digits = spaces = 0;
   for(int i = 0; str[i]!='\0'; ++i) {
      if(str[i]=='a' || str[i]=='e' || str[i]=='i' ||
      str[i]=='o' || str[i]=='u' || str[i]=='A' ||
      str[i]=='E' || str[i]=='I' || str[i]=='O' ||
      str[i]=='U') {
         ++vowels;
      } else if((str[i]>='a'&& str[i]<='z') || (str[i]>='A'&& str[i]<='Z')) 
        {
         ++consonants;
      }
         else if(str[i]>='0' && str[i]<='9')
          {
         ++digits;
      } 
        else if (str[i]==' ')
         {
         ++spaces;
      }  
   }
   cout << "The string is: " << str << endl;
   cout << "Vowels: " << vowels << endl;
   cout << "Consonants: " << consonants << endl;
   cout << "Digits: " << digits << endl;
   cout << "White spaces: " << spaces << endl;
   return 0;
}
    
index