Question: Multi part question thank you! c++ Part A: Define a struct for a Circle with a radius, circumference, area. Then define an array with 10
Multi part question thank you! c++
Part A: Define a struct for a Circle with a radius, circumference, area. Then define an array with 10 Circles. Input the radius for each circle from the user (and also set its circumference, area). Then output the area of the largest circle in the array.
Part B : If the program answers "yes" to the previous question, meaning the two strings are permutations of each other, determine if each string has all unique characters
FOR PART B:
/* function to check whether two strings are
Permutation of each other */
bool arePermutation()
{
string str1, str2;
cout << "Enter str1: ";
getline(cin, str1);
cout << "Enter str2: ";
getline(cin, str2);
// Get lenghts of both strings
int n1 = str1.length();
int n2 = str2.length();
// If length of both strings is not same,
// then they cannot be Permutation
if (n1 != n2)
return false;
// Sort both strings
sort(str1.begin(), str1.end());
sort(str2.begin(), str2.end());
// Compare sorted strings
for (int i = 0; i < n1; i++)
if (str1[i] != str2[i])
return false;
return true;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
