|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
String toupper
Hello. I am new to this method and am trying to figure out the details.
Code:
#include "stdafx.h"
#include <cctype>
#include <string>
#include <iostream>
using namespace std;
int main()
{
int i;
string str;
cout << "Type some ****. ";
cin >> str;
for (int i = 0; i < str.length(); i++)
{
str[i] = toupper (str[i]);
}
cout << "Here ya go bitches: " << str;
}
It will return the first word of the string i type in all caps; but it only returns the first word and I can't figure out why :\ |
|
#2
|
|||
|
|||
|
This is the way cin works. A space is a delimiter. It has nothing to do with toupper.
Look at the getline() function. |
|
#3
|
|||
|
|||
|
!
Ah! Thank you my good man
![]() |
|
#4
|
|||
|
|||
|
Quote:
?? LOL |
|
#5
|
||||
|
||||
|
I used to have exception statements like those. Had a sit down with my prof, can't say never, but I certainly cut down on those. How do I put it, err it is no longer a habit
![]()
__________________
The only Verdict is Vengeance a Vendetta held as a Votive, not in Vain, for the Value and Veracity of such shall one day Vindicate the Vigilant and the Virtuous Mav RLZ AC/DC RLZ |
|
#6
|
|||
|
|||
|
laf. i change that stuff before i turn it in as homework; i just write it down cause it's the first thing that comes to mind and generally that part of my code doesn't give me errors; i worry about the rest of the code first.
|
|
#7
|
||||
|
||||
|
Apparently no one has to live in the real world anymore. Pity.
__________________
Write no code whose complexity leaves you wondering what the hell you did. Politically Incorrect DaWei on Pointers Grumpy on Exceptions |
|
#8
|
||||
|
||||
|
Rofl. I noticed one of my friends' variables the other day:
boolean ****ed; if(mac != in_mac)* ****ed = true; *Something to do with an access code for TCP messaging system. Miunno :/ Also: Quote:
|
|
#9
|
|||
|
|||
|
ahahahaha yeah that's great.
and oh, you, sizable . the real world is for p***ies1 <3 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > String toupper |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|