restructured

This commit is contained in:
nihonium 2022-10-22 18:26:37 +03:00
parent c495b7c47f
commit 66cefdfd63
Signed by: nihonium
GPG key ID: 0251623741027CFC
204 changed files with 538 additions and 13662 deletions

View file

@ -0,0 +1,26 @@
#include <iostream>
using std::cout, std::endl;
void count_letters(char str[], int& n_letters, int& n_digits, int& n_other) {
while (*str) {
if (*str >= 'a' && *str <= 'z' || *str >= 'A' && *str <= 'Z') {
n_letters += 1;
}
else if (*str >= '0' && *str <= '9') {
n_digits += 1;
}
else {
n_other += 1;
}
str += 1;
}
}
int main() {
int n_letters = 0, n_digits = 0, n_other = 0;
char s[] = "1n!2y#3a$";
count_letters(s, n_letters, n_digits, n_other);
cout << "letters: " << n_letters << endl << "digits: " << n_digits << endl << "n_other: " << n_other << endl;
}