Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added capitalise in cpp #70

Merged
merged 10 commits into from Dec 29, 2018
Merged

added capitalise in cpp #70

merged 10 commits into from Dec 29, 2018

Conversation

Bhanu0202
Copy link
Contributor

@Bhanu0202 Bhanu0202 commented Dec 27, 2018

Please make sure you have done the following:

  • Created a folder with the name of language you code inside /Day<n>/ directory (Where n is for nth day)
  • Added your Codes
  • Tested your codes
  • Added credits (author and date) at the top of the code
  • Updated README.md
  • Added yourself as a contributor using all-conributors-cli

Copy link
Member

@MadhavBahl MadhavBahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Bhanu0202 it is not complete capitalization, the question is to capitalize first letter of each word in the string.

@Bhanu0202
Copy link
Contributor Author

@MadhavBahlMD The code does capitalise first letter of each word. Please check it again. Also, let me know if I am still wrong.Thanks :)

}
else{
int flag = 0, i;
transform(sa.begin(), sa.end(), sa.begin(), ::tolower);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont convert strings to lower case.
README file says Do not ignore the letter case, so Abc and abc are not anagrams.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the correction. I will update it soon.

sa[0] -= 32;
for(int i = 0; i < l; i++){
if(sa[i] == 32 && sa[i+1] != 32){
sa[i + 1] -= 32;
Copy link
Contributor

@ashwek ashwek Dec 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before subtracting 32 please check if sa[i + 1] is a lower case alphabet or not. If it is an upper case letter, subtracting 32 will give incorrect answer.
(Same for Line 14)
Input :Abc
Output :!bc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the correction. I will update it soon.

@MadhavBahl MadhavBahl merged commit fbb93a0 into CodeToExpress:master Dec 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants