Results 1 to 13 of 13

Thread: Question

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Works for me
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    1. First tell us the error
    2. Try including <ctype.h>

  3. #3
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Tolower

    I want to transform I into lowercase
    as if I is an CIN from the user.

    Please give advice

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  4. #4

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: Tolower

    Originally posted by prog_tom
    I want to transform I into lowercase
    as if I is an CIN from the user.

    Please give advice
    I'm not really following. You cin a char into I, say 'V', and tolower() makes it lower case. It works for me.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Post Code

    Can you post the code of getting lowercase of a CIN? Thanks

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  6. #6

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Code:
    #include <iostream>
    
    #include <time.h>
    #include <math.h>
    using namespace std;
    char I;
    
    void main()
    {
    	system("cls");
    
    
    	cin >> I;
    	I = tolower(I);
    	cout << "\n\tWelcome to this hot stuff! " << I << endl;
    
    	system("pause");
    	
    	exit(0);
    }
    your code works for me.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  7. #7
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Yes

    But only 1 letter...

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  8. #8
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Post I want

    I want it to do it for up to 256 chars

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  9. #9
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Re: I want

    Originally posted by prog_tom
    I want it to do it for up to 256 chars
    It will work for all the upper case letters. I think, I is confusing you. Use this code:

    VB Code:
    1. #include <iostream>
    2.  
    3. #include <time.h>
    4. #include <math.h>
    5. using namespace std;
    6. char word;
    7.  
    8. void main()
    9. {
    10.     system("cls");
    11.  
    12.  
    13.     cin >> word;
    14.     word = tolower(word);
    15.     cout << "\n\tWelcome to this hot stuff! " << word << endl;
    16.  
    17.     system("pause");
    18.    
    19.     exit(0);
    20. }

    Now, if you type "A", it`s gonna print ``a``. Samething for all the other letters.
    Baaaaaaaaah

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    If you want to uppercase a whole C style string you can iterate trough the array and lowercase each letter

    char I[256],*i;
    cin >> I;
    for(i=I;*i;*i++=tolower(*i));
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  11. #11
    Addicted Member
    Join Date
    Aug 2001
    Location
    I'm mobile
    Posts
    166
    that's pretty it the easiest solution..........just use the for loop or any other iteration command
    [p r a e t o r i a n]

  12. #12
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    keda, this is the most confusing code I've EVER EVER seen! Such things easily fall to the postfix/prefix trap! I don't fear that you'll ever fall into it, but it can easily hit others in snippets like this...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  13. #13
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I know the operator presedence pretty well
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width