Hi,
Getting error when trying to compile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <stdio.h>
#include <ctype.h>
#include <string>
using namespace std;
void to_lower(const char*s);
{
for (*s; ++s) {
*s = (tolower(s)); // make lower
}
}
int main()
{
char p;
while (cin>>p) { to_lower (p); }
return 0;
}
|
Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <stdio.h>
#include <ctype.h>
#include <string>
void to_lower( char*s);
{
for (; *s; ++s) {
*s = (tolower(*s)); // make lower
}
void test(const string& ss)
{
string s = ss;
cout << s << '\n';
char* p = &s[0];
to_lower(p);
cout << p << '\n';
}
int main()
{
test("Hello, World!");
string s;
while (cin>>s && s!="quit")
test(s);
}
|
Last edited on