English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Can you help me? How can I create a program using c++ that if I type a name the name will be in Uppercase, Lowercase, and Reverse w/o using strupr, strlwr, and strrev and using array and loop statement for the main program and I don't know the other condition that to be use. plssss help me...

2007-03-13 21:36:04 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

the one that i've figure it out is to use toupper and tolower but if im trying to put it in my command invalid... Plssss help me to figure it out....

2007-03-15 02:24:34 · update #1

2 answers

>not good in c++
> i did not use methods.
>i did strlen() function as u did not mention
here goes

#include
#include
#include
int main()
{
int len,asc[20];
char name[20],lo[20]="",up[20]="",rev[20]="";
cout<<"Enter your name:";
cin>>name;
len=strlen(name);
for(int i=0;i asc[i]=toascii(name[i]);
//to lower case
for(i=0;i {
if(toascii(name[i]>96))
lo[i]=name[i];
else
lo[i]=toascii(name[i]+32);
}
//to upper case
for(i=0;i {
if(toascii(name[i]>96))
up[i]=toascii(name[i]-32);
else
up[i]=toascii(name[i]);
}
//reversing
for(i=0;i rev[i]=name[len-i-1];
cout<<"\nname in lower case is "< cout<<"name in upper case is "< cout<<"name in reverse is "< return 0;
}


did each of the 3 three things separately instead of doing it together

2007-03-13 22:43:25 · answer #1 · answered by rejin reeza 3 · 0 0

make an array of caracters which stores the string caracter
us the for loop to access and edit each carcater..

2007-03-13 22:39:03 · answer #2 · answered by abd 5 · 0 0

fedest.com, questions and answers