Questions tagged [toupper]

In C / C++ toupper function converts a given character to uppercase according to the character conversion rules defined by the currently installed C locale. In the default "C" locale, the following lowercase letters abcdefghijklmnopqrstuvwxyz are replaced with respective uppercase letters ABCDEFGHIJKLMNOPQRSTUVWXYZ.

176 questions
1
vote
2 answers

Why I cant print initials of a name?

I am trying to write a code that prints initials of a given name? I have been getting error whenever I use '/0' - to initialize the ith character of a given string. I am using it to identify initials of the 2nd word? Any suggestions to detect the…
Aakash
  • 73
  • 8
1
vote
5 answers

In Programming Code to Convert Lowercase to Uppercase why do we use(str[i]>=97 && str[i]<=122)?

So this is the program I have used to Convert Lowercase, to Uppercase can you tell me why do we use this thing?[(str[i]>=97 && str[i]<=122)] in the following code section? #include #include #include void main() { …
Veritasium
  • 49
  • 9
1
vote
1 answer

How to force text to be Upper case except selective strings c#

C#: string mystring = "Hello World. & my name is < bob >. Thank You." Console.Writeline(mystring.ToUpper()) I am trying to get all the text to be uppercase except-- & < > Because these are my encoding and the encoding wont…
Dev
  • 1,780
  • 3
  • 18
  • 46
1
vote
3 answers

How to use toupper() function to count both lowercase and uppercase user input?

I have an array of size 25 that stores capital letters in an array. It stores, for my user input test, 'A', 'B', 'C', and 'D'. My program counts the amount of those letters in the array and prints it out. For example, if AABBCCDD was entered, it…
CodeFreak
  • 90
  • 1
  • 2
  • 15
1
vote
2 answers

upper to lower and vice-versa without loop in C++?

Input: abcdE Output: ABCDe I am looking for an efficient and less code solution for this code: #include #include using namespace std; int main() { int len, ; string data; cin >> data; len =…
1
vote
4 answers

Converting strings to uppercase to compare with user input in C

I am attempting to create a program that will allow a user to search for a name in a file. The program does this successfully, but then it occurred to me that not everyone will type in the name as it is capitalized in the file. That is, someone may…
eruiggy
  • 25
  • 5
1
vote
1 answer

Assembly: lowercase to UPPERCASE

I need to transform "h4ppy c0d1ng" into "H4PPY C0D1NG". I am a beginner in this language, but here is my attempt (ubuntu i386 VirtualBox Mac).I think the int 21h is wrong, other than that the program won't finish nor print the string when…
j1nma
  • 457
  • 3
  • 9
  • 24
1
vote
6 answers

How to uppercase a letter in the middle of a string?

I'm trying to uppercase the first letter in a string that is located after the first space: string name = "Jeffrey steinberg"; I'm trying to uppercase the S in steinberg. I'm not sure how to do this. I've tried messing around w/ the toupper…
Doughy
  • 21
  • 1
  • 3
1
vote
3 answers

for loop c++ 'toupper' implementation

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 #include using namespace std; int main(){ string sample("hi, i like…
user3697625
  • 167
  • 4
  • 17
1
vote
0 answers

How to make a string uppercase (extended ASCII)?

I wrote this function to make a string all uppercase. Unfortunately, it does not work with the extended ASCII characters, like ä, ö, ü, é, è and so on. How can I convert the string to uppercase and convert these characters also (Ä, Ö, Ü, É, È)? void…
Fabian
  • 4,001
  • 4
  • 28
  • 59
1
vote
1 answer

error convert character in string to uppercase

I'm trying to convert character of a string to uppercase letters int main (void) { int i = 0; int n = 0; static char *str[] = { "wow", "RACEcar", "No devil lived on.", …
khoa_vo123
  • 29
  • 5
1
vote
1 answer

Converting characters in strings to uppercase not working

I have this C++ code(Which I will explain below): #include #include #include #include using namespace std; int main() { // part 1 cout << "Write many words separated by either newlines or spaces:"<<…
wingerse
  • 3,670
  • 1
  • 29
  • 61
1
vote
1 answer

Convert to upper case only comments from a c++ program

I am trying to read a file and then convert the comments to upper case inside the file. Here is my code: char s[100]; void initstring(); void error(char); void cap(char s[]); void main(void) { initstring(); getchar(); } void initstring() { FILE…
Fahad Khan
  • 1,635
  • 4
  • 23
  • 37
1
vote
2 answers

QT: cannot access private member declared in class 'QByteArray'

I've been trying to create a random phrase generator, which reads nouns from one text file and verbs from another text file. That all worked, but now I'm trying to write a method that capitalizes the first letter of the subject, but keep getting the…
ArcWalrus
  • 33
  • 1
  • 7
1
vote
2 answers

Segmentation fault cause by toupper

So, I'm trying to write a function that takes a string and changes all lowercase values to uppercase. Here's the code: void lowerToUpper(char *s) { …