Trouble Coding a Program (w/functions using isupper and islower)
Feb 27, 2009 at 8:30pm UTC
I'm trying to code a program that will be used as a decoding programing, that will take a text document's contents, and decode it using the program.
Here is the code I have so far.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
#include <iostream>
#include <iomainip>
using namespace std;
// Function Prototypes
char convUpper( char );
char convLower( char );
char convDigit( char );
char convPunct( char );
char checkSpecial( char );
// Main Function
int main()
{
char ch;
cin >> ch;
while ( cin )
{
if ( islower (ch) )
convUpper( );
else if ( isupper (ch) )
convLower( );
else if ( ispunct (ch) )
convDigit( );
else ( isdigit (ch) )
convPunct( );
cin >> ch;
}
return 0;
system "pause" ;
}
//Functions
char convUpper( char ch )
{
}
char convLower( char ch )
{
}
char convPunct( char ch )
{
if ( ch == ! )
cout << "9" ;
else if ( ch == ? )
cout << "8" ;
else if ( ch == ) )
cout << "7" ;
else if ( ch == ( )
cout << "6" ;
else if ( ch == * )
cout << "5" ;
else if ( ch == % )
cout << "4" ;
else if ( ch == & )
cout << "3" ;
else if ( ch == $ )
cout << "2" ;
else if ( ch == . )
cout << "1" ;
else ( ch == , )
cout << "0" ;
return ch;
}
char convDigit( char ch )
{
if ( ch == 0 )
cout << "!" ;
else if ( ch == 1 )
cout << "@" ;
else if ( ch == 2 )
cout << ")" ;
else if ( ch == 3 )
cout << "(" ;
else if ( ch == 4 )
cout << "*" ;
else if ( ch == 5 )
cout << "%" ;
else if ( ch == 6 )
cout << "&" ;
else if ( ch == 7 )
cout << "$" ;
else if ( ch == 8 )
cout << "^" ;
else ( ch == 9 )
cout << "#" ;
return ch;
}
char checkSpecial( char ch )
{
}
I need to code my convUpper and convLower functions to take whatever was lower to upper and whatever was upper to lower, but also adding one to the value of upper. For example a C would become a lower case b, and a c would become an upper case B. If Z was to be entered it would need to loop to lower case a. For checkSpecial, it will only activate if the ASCII 30 or 31 is seen. if 30, a blank space is produced, if 31, then a new line character.
Any pointers from you guys?
Topic archived. No new replies allowed.