Write a function fctx that takes a list of strings, named aList, as argument and
ID: 3903484 • Letter: W
Question
Write a function fctx that takes a list of strings, named aList, as argument and returns a new list containing all the elements of aList capitalized.print(ex1(['pace','FISH','Duck']))
Write a function fctx that takes a list of strings, named aList, as argument and returns a new list containing all the elements of aList capitalized.
print(ex1(['pace','FISH','Duck']))
Write a function fctx that takes a list of strings, named aList, as argument and returns a new list containing all the elements of aList capitalized.
print(ex1(['pace','FISH','Duck']))
Write a function fctx that takes a list of strings, named aList, as argument and returns a new list containing all the elements of aList capitalized.
print(ex1(['pace','FISH','Duck']))
Write a function fctx that takes a list of strings, named aList, as argument and returns a new list containing all the elements of aList capitalized.
print(ex1(['pace','FISH','Duck']))
Explanation / Answer
#include<iostream>
#include<cstring>
using namespace std;
void func(string str1, string x2, string x3)
{
int len=str1.length();
int len2=str1.length();
int len3=str1.length();
for(int i=0;i<=len;i++)
{
if(str1[i]>=97 && str1[i]<=122)
{
str1[i]=str1[i]-32;
}
else
str1[i]=str1[i];
}
cout<<str1<<endl;
for(int i=0;i<=len2;i++)
{
if(x2[i]>=97 && x2[i]<=122)
{
x2[i]=x2[i]-32;
}
else
x2[i]=x2[i];
}
cout<<x2<<endl;
for(int i=0;i<=len3;i++)
{
if(x3[i]>=97 && x3[i]<=122)
{
x3[i]=x3[i]-32;
}
else
x3[i]=x3[i];
}
cout<<x3;
}
int main()
{
func("duck","Owl", "Hotel");
return 0;
}
output:
DUCK
OWL
HOTEL
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.