added double jump and sitting state
This commit is contained in:
parent
2e5c5a8dde
commit
90d07dde3f
148 changed files with 13050 additions and 0 deletions
26
term1/seminar01_overload/04_count_letters/count_letters.cpp
Normal file
26
term1/seminar01_overload/04_count_letters/count_letters.cpp
Normal 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;
|
||||
}
|
||||
Reference in a new issue