Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add @imkaka as a contributor * Day2 Cpp
- Loading branch information
1 parent
2dbc909
commit 40c87f7
Showing
5 changed files
with
133 additions
and
7 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* @author: imkaka | ||
* @date : 21/12/2018 | ||
*/ | ||
|
||
#include<iostream> | ||
#include<string> | ||
|
||
using namespace std; | ||
|
||
int main(){ | ||
|
||
string str; | ||
cin >> str ; | ||
|
||
int size = str.size(); | ||
bool flag = false; | ||
for(int i = 0; i< size/2; i++) | ||
{ | ||
if(str[i] != str[size-i-1]) | ||
{ | ||
flag = true; | ||
break; | ||
} | ||
} | ||
|
||
if(!flag) | ||
cout << str <<" is a Palindrome!!" << endl; | ||
else | ||
cout << str << " is NOT a Palindrome!" << endl; | ||
|
||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* @author: imkaka | ||
* @date : 21/12/2018 | ||
*/ | ||
|
||
#include<iostream> | ||
#include<string> | ||
|
||
using namespace std; | ||
|
||
int main(){ | ||
|
||
string str; | ||
cin >> str ; | ||
|
||
int size = str.size(); | ||
for(int i = 0; i< size/2; i++) | ||
{ | ||
char temp = str[i]; | ||
str[i] = str[size-i-1]; | ||
str[size-1-i] = temp; | ||
} | ||
|
||
cout << str << endl; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters