Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

ANAGRAM: Why does my code go straight to asking for the second string when i repeat it???

+3 votes
asked Jun 7 by hikhok (150 points)

I'm try to code a program that will detect if two strings are anagrams while disregarding the spaces and capitalization of the input. Its also supposed to give the user a choice whether they want to continue or not. It works fine for the first try but when I select 'y' to repeat the program it goes straight to asking for the second string.

Pls help me. Im a beginner to coding so I don't know much yet crying


here is the link to my code:

https://onlinegdb.com/q4IoP65Yu

1 Answer

0 votes
answered Jun 9 by Peter Minarik (58,190 points)

You have the same problem as this. Check the Mixed Input Methods section of my answer there.

TL;DR; Do not mix getline() with other methods that read from the stdin.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...