C to C++

Hello i need to change this line code from c to c++ but i dont know how

1
2
3
4
5
6
 int main(){
  int k = 0;
  string text;
  using namespace std;
  cout<<"text to atbash: ";
  scanf("%[^\n]",&text); /* this one*/
I'm no expert on scanf but I think what you want is std::getline: http://www.cplusplus.com/reference/string/string/getline/

 
std::getline(std::cin, text);
thanks, i use
 
getline(std::istream, &text);
Topic archived. No new replies allowed.