I'm new to cpp, it's been 2 weeks since i stared learning.
Today this weird bug or what it is called, causing my code to run weird way and not working as expected, thing is if I use only std::cin code runs perfectly fine but things got shaky when I add std::getline and then the program stops.
Here's my simple code.
#include <iostream>
int main(){
    int age;
    std::cout << "Age: ";
    std::cin >> age;
    std::cout << age << "\n";
    
    std::string Name;
    std::cout << "Name\n";
    std::getline(std::cin, Name);
    std::cout << Name << "\n";
    return 0;
}
output
chitti@Thor /m/4/F/Langs> cd "/mnt/404EA75214A150D1/Files/Langs/Cpp/" && g++ main.cpp -o main && "/mnt/404EA75214A150D1/Files/Langs/Cpp/"main
Age: 55
55
Name
chitti@Thor /m/4/F/L/Cpp>
 
    