C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 26th, 2009, 11:14 PM
brandonpxdx brandonpxdx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 29 brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 h 24 m 34 sec
Reputation Power: 0
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 :\

Reply With Quote
  #2  
Old October 26th, 2009, 11:51 PM
jnmacd jnmacd is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 8 jnmacd User rank is Corporal (100 - 500 Reputation Level)jnmacd User rank is Corporal (100 - 500 Reputation Level)jnmacd User rank is Corporal (100 - 500 Reputation Level)jnmacd User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 h 47 m 3 sec
Reputation Power: 0
This is the way cin works. A space is a delimiter. It has nothing to do with toupper.
Look at the getline() function.

Reply With Quote
  #3  
Old October 27th, 2009, 12:09 AM
brandonpxdx brandonpxdx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 29 brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 h 24 m 34 sec
Reputation Power: 0
!

Ah! Thank you my good man

Reply With Quote
  #4  
Old October 29th, 2009, 10:14 AM
Ronster Ronster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Location: Charlotte
Posts: 243 Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Days 13 h 42 m 10 sec
Reputation Power: 130
Quote:
Originally Posted by brandonpxdx
cout << "Here ya go bitches: " << str;


?? LOL
Comments on this post
IOI-RLZ agrees!

Reply With Quote
  #5  
Old October 29th, 2009, 02:26 PM
IOI-RLZ's Avatar
IOI-RLZ IOI-RLZ is offline
BANDITS 6'0 Clock !
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2006
Location: at the top of the stairway to heaven.
Posts: 698 IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)IOI-RLZ User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 7098 Folding Title: Novice Folder
Time spent in forums: 2 Weeks 1 Day 22 h 39 m 33 sec
Reputation Power: 196
Send a message via MSN to IOI-RLZ Send a message via Yahoo to IOI-RLZ
Facebook
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

Reply With Quote
  #6  
Old October 29th, 2009, 02:49 PM
brandonpxdx brandonpxdx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 29 brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 h 24 m 34 sec
Reputation Power: 0
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.
Comments on this post
IOI-RLZ agrees!

Reply With Quote
  #7  
Old October 29th, 2009, 05:35 PM
sizablegrin's Avatar
sizablegrin sizablegrin is offline
Crab
Click here for more information.
 
Join Date: Jun 2005
Posts: 5,783 sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level)sizablegrin User rank is General 53rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 11 h 27 m 3 sec
Reputation Power: 4482
Apparently no one has to live in the real world anymore. Pity.
Comments on this post
L7Sqr agrees: I write my proposals in 1337, but only cause it impresses my boss. I code exclusively in Brain****.
__________________
Write no code whose complexity leaves you wondering what the hell you did.
Politically Incorrect DaWei on Pointers Grumpy on Exceptions

Reply With Quote
  #8  
Old October 29th, 2009, 07:58 PM
Wetmelon's Avatar
Wetmelon Wetmelon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: London, ON
Posts: 82 Wetmelon User rank is Sergeant Major (2000 - 5000 Reputation Level)Wetmelon User rank is Sergeant Major (2000 - 5000 Reputation Level)Wetmelon User rank is Sergeant Major (2000 - 5000 Reputation Level)Wetmelon User rank is Sergeant Major (2000 - 5000 Reputation Level)Wetmelon User rank is Sergeant Major (2000 - 5000 Reputation Level)Wetmelon User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 18 h 8 m 39 sec
Reputation Power: 47
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:
Originally Posted by Bash.org
<ddubb> if there is no local area ID found, drop the load data.
<ddubb> or, in code form:
<ddubb> if (!getLAid()) dropLoad();
<ddubb> line 525 of software that ships tomorrow.
<ddubb> my work here is done.

Reply With Quote
  #9  
Old October 29th, 2009, 10:53 PM
brandonpxdx brandonpxdx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 29 brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level)brandonpxdx User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 h 24 m 34 sec
Reputation Power: 0
ahahahaha yeah that's great.
and
oh, you, sizable . the real world is for p***ies
1 <3
Comments on this post
Ronster agrees!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > String toupper


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek