toupper

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JasBascom

    toupper

    if i have

    struct crecord{
    char record_type;
    }

    if record_type = 'c';

    how do I make record_type toupper?
  • Sumit Rajan

    #2
    Re: toupper


    "JasBascom" <jasbascom@aol. com> wrote in message
    news:2004022321 5214.12245.0000 0328@mb-m02.aol.com...[color=blue]
    > if i have
    >
    > struct crecord{
    > char record_type;
    > }
    >
    > if record_type = 'c';
    >
    > how do I make record_type toupper?[/color]



    #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(cr 1.record_type);
    cr2.record_type = std::toupper(cr 2.record_type);

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

    }


    Regards,
    Sumit.


    Comment

    • Mike Wahler

      #3
      Re: toupper


      "JasBascom" <jasbascom@aol. com> wrote in message
      news:2004022321 5214.12245.0000 0328@mb-m02.aol.com...[color=blue]
      > if i have
      >
      > struct crecord{
      > char record_type;
      > }
      >
      > if record_type = 'c';
      >
      > how do I make record_type toupper?[/color]

      #include <iostream>
      #include <locale>

      struct crecord
      {
      char record_type;
      };

      int main()
      {
      crecord rec = {'c'};
      std::locale loc;
      rec.record_type = std::toupper(re c.record_type, loc);
      std::cout << rec.record_type << '\n'; /* prints 'C' */
      return 0;
      }


      -Mike


      Comment

      Working...