473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

toupper

if i have

struct crecord{
char record_type;
}

if record_type = 'c';

how do I make record_type toupper?
Jul 22 '05 #1
2 1898

"JasBascom" <ja*******@aol.com> wrote in message
news:20***************************@mb-m02.aol.com...
if i have

struct crecord{
char record_type;
}

if record_type = 'c';

how do I make record_type toupper?


#include <iostream>
#include <cctype>

struct crecord {
char record_type;
};

int main()
{
crecord cr1, cr2;
cr1.record_type = 'c';
cr2.record_type = 'C';

cr1.record_type = std::toupper(cr1.record_type);
cr2.record_type = std::toupper(cr2.record_type);

std::cout << cr1.record_type << '\t' << cr2.record_type << '\n';

}
Regards,
Sumit.
Jul 22 '05 #2

"JasBascom" <ja*******@aol.com> wrote in message
news:20***************************@mb-m02.aol.com...
if i have

struct crecord{
char record_type;
}

if record_type = 'c';

how do I make record_type toupper?


#include <iostream>
#include <locale>

struct crecord
{
char record_type;
};

int main()
{
crecord rec = {'c'};
std::locale loc;
rec.record_type = std::toupper(rec.record_type, loc);
std::cout << rec.record_type << '\n'; /* prints 'C' */
return 0;
}
-Mike
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Kerri | last post by:
Hi, I have a string 'hello world' I can UCase my string using String.ToUpper Is there anyway to just UCase the first letter ofe ach word? Thanks,
7
by: Duane | last post by:
Aside from the pitfalls of using this function, according to the standard, what is the correct way to call it? #include <string> #include <locale> // seems to work with BCC5.6/STLPort...
18
by: didgerman | last post by:
Chaps, I need to properly format the case of a struct. Can I just hit it with tolower, and then 'while (string ==' ') pos++; string=toupper(string); to add in the higher case for the start of...
3
by: gelbeiche | last post by:
I have a question regarding the following small C program. #include <locale.h> int main() { char* loc = 0; char before,after; int i;
0
by: Shrinivas Reddy | last post by:
Hi, I am using the ToUpper() function in an FXCop rule which checks whether a boolean variable has "is" or "has" as the prefix. The ToUpper() function does not work. When I put the expression...
48
by: Frederick Gotham | last post by:
The "toupper" function takes an int as an argument. That's not too irrational given that a character literal is of type "int" in C. (Although why it isn't of type "char" escapes me... ) The...
4
by: sandy | last post by:
I am trying to upper case a string, so I have this method: string FileSystem::toupper(string S) { for (int i=0; i<S.length(); ++i) { S=toupper(S); } return S;
13
by: JanWhitney | last post by:
I am learning C++, so please be kind. Is there anywhere that I can view the source code for the toUpper function? Thanks.
16
by: gaga | last post by:
my function should accept a pointer to a string as its argument. and it should convert each charater to an uppercase letter. I know what i need to do, its just my syntax is all out of whack. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.