Answer to Question #1579 in C++ for Dwayne

Question #1579
Write a function called Reverse() which takes a string as a parameter. The function should convert all lower case letters to upper case and upper case letter to lower case.
1
Expert's answer
2011-03-07T09:05:52-0500
// Lowercaseletterstoupper.cpp : Defines the entry point for the console application.//
#include "stdafx.h"
#include #include #include using namespace std;

char str[80];
char string;
int i;

void Reverse(char str[80]){
for( i = 0; str[ i ]; i++){
str[ i ] = toupper( str[ i ] );
}
printf("Uppercase string is - %s
", str); /* uppercase string */

for(i = 0; str[ i ]; i++){
str[i] = tolower(str[ i ]);
}
printf("Lowercase string is - %s
", str); /* lowercase string */
}

int _tmain(int argc, _TCHAR* argv[])
{
printf("Enter a string: ");
Reverse(gets(str));
getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS