computer programming
computer programming
int max_count = 0;
int count=1;
if (nums[i]==nums[j])
count++;
if (count>max_count)
max_count = count;
int count=1;
if (nums[i]==nums[j])
count++;
if (count==max_count)
int main()
int n = sizeof(nums)/sizeof(nums[0]);
cout << "Original array: ";
most_occurred_number(nums, n);
#include <iostream>
using namespace std;
void lower_string(string str)
{
for(int i=0;str[i]!='\0';i++)
{
if (str[i] >= 'A' && str[i] <= 'Z') //checking for uppercase characters
str[i] = str[i] + 32; //converting uppercase to lowercase
}
cout<<"\n The string in lower case: "<< str;
}
void upper_string(string str)
{
for(int i=0;str[i]!='\0';i++)
{
if (str[i] >= 'a' && str[i] <= 'z') //checking for lowercase characters
str[i] = str[i] - 32; //converting lowercase to uppercase
}
cout<<"\n The string in upper case: "<< str;
}
int main()
{
string str;
cout<<"Enter the string ";
getline(cin,str);
lower_string(str); //function call to convert to lowercase
upper_string(str); //function call to convert to uppercase
return 0;
} } 3. Program to find the vowels in given string #include <iostream>
#include <stdio.h>
using namespace std;
bool isVowel(char c){
// converts char to upper case if it was lowercase
c = toupper(c);
int main()
{
char str[100] = "prepinsta";
int vowels = 0;
return 0;
}
int main() {
int d, m, y;
cout << "Enter today's date in the format: DD MM YYYY\n";
cin >> d >> m >> y;
Output:
Tomorrow's date:
01 03 2020
5. Program to Print a Full Pyramid Using *
// C++ code to demonstrate star Pyramid
#include <iostream>
using namespace std;
// for spacing
while (k <= n - i - 2) {
cout << " ";
k++;
}
k = 0;
// Driver Code
int main()
{
int n = 5;
// Function Call
pypart2(n);
return 0;
}