Prosty program mający zamienić małe litery na wielkie. Wszystko jest ok poza jedną rzeczą - chciałbym, aby przy podaniu przez użytkownika literki "q" program kończył swoje działanie, lecz niestety coś w while'u skopałem.
#include "stdafx.h"
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
void zamien_tekst(std::string & text);
int _tmain(int argc, _TCHAR* argv[])
{
string text;
cout << "Wprowadz tekst:" << endl;
while (!(cin >> text) && text[0]!='q')
zamien_tekst(text);
cin.get();
cin.get();
return 0;
}
void zamien_tekst(std::string & text)
{
int i = 0;
while (text[i] != '\0')
{
cout << static_cast<char>(toupper(text[i]));
i++;
}
}