0

Can someone help me in this

Q11: (Program) Write a C++ program that asks for two lowercase characters. Pass the two entered characters, using pointers, to a function named capit(). The capit() function should capitalize the two letters and return the capitalized values to the calling function through its pointer arguments. The calling function should then display all four letters. I'm quite stuck in this question šŸ˜“ Here is my code #include <iostream> #include <string> using namespace std; void capit(char *str, char *str2) { char lower1 , lower2; cout<<(toupper(lower1)); cout << endl; putchar(toupper(lower2)); cout << endl; //cout << upp << endl; //cout << upp << endl; } int main() { char lower1, lower2; cout << "enter first letter :"; cout << endl; cin >> lower1; cout<< "enter second letter :"; cin >> lower2; capit(&lower1, &lower2); return 0; }

26th Dec 2020, 12:56 PM
Decoder šŸ‘©ā€šŸ’»
5 Answers
+ 5
toupper() requires header file ctype.h
26th Dec 2020, 1:03 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 1
Is this what you are looking for ? #include <iostream> #include <string> #include <cctype> using namespace std; void capit(char *str, char *str2) { char lower1 , lower2; lower1=*str; lower2=*str2; putchar(toupper(lower1)); cout << endl; putchar(toupper(lower2)); cout << endl; //cout << upp << endl; //cout << upp << endl; } int main() { char lower1, lower2; cout << "enter first letter :"; cout << endl; cin >> lower1; cout<< "enter second letter :"; cin >> lower2; capit(&lower1, &lower2); return 0; }
26th Dec 2020, 1:40 PM
Abhay
Abhay - avatar
0
When I run my code Output is : Enter 1 letter : // input b Enter 2 letter : // input a 0
26th Dec 2020, 1:08 PM
Decoder šŸ‘©ā€šŸ’»
0
The process is not executed
26th Dec 2020, 1:09 PM
Decoder šŸ‘©ā€šŸ’»
0
šŸ„ŗ thank uuu
26th Dec 2020, 1:49 PM
Decoder šŸ‘©ā€šŸ’»