FAQ Database Discussion Community


for loop c++ 'toupper' implementation

c++,toupper
Can someone explain why this short code in C++ doesn't produce the expected output. The code is supposed to print the string in capital letters. #include <iostream> #include <string> using namespace std; int main(){ string sample("hi, i like cats and dogs."); cout << "small: " << sample << endl <<...

why does these toupper work different when utilized like this?

c++,toupper
why does one give me an int and the other doesn't?: toupper(member_names[2]); and: member_names[2] = toupper(member_names[2]); ...

Why is the alphabet split into multiple ranges in this C code?

c++,c,character,toupper
In a custom library I saw an implementation: inline int is_upper_alpha(char chValue) { if (((chValue >= 'A') && (chValue <= 'I')) || ((chValue >= 'J') && (chValue <= 'R')) || ((chValue >= 'S') && (chValue <= 'Z'))) return 1; return 0; } Is that an Easter egg or what are...

toupper tolower not working , help what's wrong with my code

c++,for-loop,tolower,toupper
main.cpp #include <iostream> #include "Module2.h" int main() { std::cout<<"This is a test of Module2.h"<<std::endl; std::cout<<UCase("This is a test of UCase")<<std::endl; std::cout<<LCase("This is a test of LCase")<<std::endl; system("pause"); return 0; } Module2.h #include <iostream> #include "Module2.h" int main() { std::cout<<"This is a test of Module2.h"<<std::endl; std::cout<<UCase("This is a test of UCase")<<std::endl;...