Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- void Print(string* arr, int size) {
- for (int i = 0; i < size; i++) {
- cout << arr[i] << endl;
- }
- }
- void Dobutok(string* a, int size) {
- string MinElement;
- int MinLenght = _I32_MAX;
- for (int i = 0; i < size; i++) {
- if (a[i].length() < MinLenght) {
- MinElement = a[i];
- MinLenght = a[i].length();
- }
- }
- string MaxElement;
- int MaxLenght = 0;
- for (int i = 0; i < size; i++) {
- if (a[i].length() > MaxLenght) {
- MaxElement = a[i];
- MaxLenght = a[i].length();
- }
- }
- cout << "MinElement: " << MinElement << endl;
- cout << "MaxElement: " << MaxElement << endl;
- cout << "Dobutok: " << MaxLenght * MinLenght << endl;
- }
- int main() {
- const int size = 9;
- string a[size] = { "qw", "wer", "tyut", "bnmnbgb", "ghfg", "/.gf", "fdgfd", "gv", "sdf" };
- Print(a, size);
- cout << endl;
- Dobutok(a, size);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement