There is a task, a line is found, when outputting there should be two lines, one displays the characters only in upper case, the second only in the lower case. He began to write, a cycle to determine the lower case, displays everything, but stops if there is a character with an upper case on his way. How to correct the code?
#include "stdafx.h" #include <iostream> #include <cstdio> #include <cctype> using namespace std; int main() { setlocale(LC_ALL, "Russian"); int str0=0; char str[100],str1, str2; cout << "Строка: "; cin >> str; while (str[str0]) { str1 = str[str0]; if (islower(str1)) { cout << str1; str0++; } } system("pause"); return 0; }
stris an array,str0is an integer index, andstr1is a symbol in general. Themselves confused, not to mention others. You're not a partisan writing programs for the Gestapo? And also - well, what's the point ofstr1variable? - Harry