+ 2
Hello everyone...! C++ programmer i have a puzzle for you can you do that its upto you...!
take a sentence like "i am programmer" in lower case letter and convert that into uparcase after execution but don't use c++ library build in funtions use you on logic....
8 Réponses
+ 3
// here is the code no external library rather than iostream
#include <iostream>
using namespace std;
char toUP(char c){
int ascii = int(c);
if(ascii >= 97 && ascii <=122)
return char(ascii-32);
else return c;
}
int main(){
char inp[40];
cin.getline(inp,40);
int len = 0;
for(len=0;inp[len]!='\0';len++)
inp[len] = toUP(inp[len]);
for(int j=0;j<len;j++) cout<<inp[j];
return 0;
}
+ 3
what you need ?
acc to ur question , I added no library
if user enters wrong charecter the program will automatically detect it.
what logic ?
there is a simple logic if the character is smaller case decrease 32 to get the uppercase
+ 2
I don't know C++, but I wrote it in a language I do know anyway
myString="i am programmer"
for c in myString:
if c==" ":
print(" ",end='')
else:
num=ord(c)-32
let=chr(num)
print(let, end='')
Output:
I AM PROGRAMMER
+ 2
make it short and understandable its good...4star
+ 1
do that but create your logic
+ 1
good fantastic to the point
0
lol if you can't do that, and you are not of that level so don't say that its my homework lol, hahaha it is just for those peoples who want to make their self professional...
0
a little bit near to my point