answer (Минимальная цифра в числе, количество мин цифр в числе)

#include "stdafx.h"//del #include <iostream> #include <string> using namespace std; int main() { string str; cout << "Enter the number: "; cin >> str; int min = str[0] - '0'; for (int i = 0; i < (str.size()); i++) { if ((str[i] < '0') || (str[i] > '9')) { cout << "Not a number"; exit(1); } if (min > (str[i] - '0') ) min = (str[i] - '0'); } int count = 0; for (int i = 0; i < (str.size()); i++) if ((str[i] - '0') == min) count++; cout <<endl <<"Minimum number: " << min; cout << endl << "Number of repetitions : " << count << endl; return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.