char C++

Page 1 of 1

1 Replies - 1352 Views - Last Post: 17 March 2013 - 05:12 PM Rate Topic: -----

#1 sacdeli  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-March 13

char C++

Posted 17 March 2013 - 04:55 PM

I am trying to convert uppercase to lower case and vice versa, the program gives me error. This is the code so far:
include <iostream>
using namespace std;
int main()
{
    char ch;
    do
      {  cout <<"\n Enter a character: ";
         ch=getchar();
         if (ch>=65 && ch<=90)       
            ch = ch + 32;            
         else
             if (ch >=97 && ch <= 122)
             ch = ch -32;             
        putchar(ch);
      } while (ch!='0');

    return 0;
}



Is This A Good Question/Topic? 0
  • +

Replies To: char C++

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3718
  • View blog
  • Posts: 5,990
  • Joined: 08-June 10

Re: char C++

Posted 17 March 2013 - 05:12 PM

Don't double post your questions.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1