#include <windows.h> #include <iostream> #include <cstdlib> using namespace std; int main() { HANDLE hOut; int hConsole = GetStdHandle(STD_OUTPUT_HANDLE); string tekst; string wzorzec; getline(cin, tekst); getline(cin, wzorzec); for (int i(0); i<tekst.size(); i++) { if (tekst[i]==wzorzec[0]) { int pom=0;int l=0; while(tekst[l+i]=wzorzec[l]) { pom++; l++; } if(pom==wzorzec.size()) for (int k(i); k<wzorzec.size);k++){ SetConsoleTextAttribute( hOut, FOREGROUND_BLUE | FOREGROUND_INTENSITY ); cout<<tekst[i]<<endl;} } } return 0; }
Co poprawić, żeby tekst się wyświetlił na kolorowo?