cout <<"Pls enter your name : "<<endl; getline(cin, name);
cin.get(ch);
transform(name.begin(),name.end(),name.begin(),tolower);
}
cout <<fixed<<setprecision(2);
cout <<"The total sales is: $"<<total<<endl;
return 0;
}
The while loop is an infinite loop which may be caused by the bold part of this program.
I tried to find the solution and I found that if I used cin>>name; to be instead of the bold part of the program, the infinited loop was solved,but I can not input a string with space.