How to use the getline command in c++?

前端 未结 5 1338
难免孤独
难免孤独 2021-02-03 14:22

I\'m trying to turn a cout command into a getline command in c++.

This is my code that I\'m trying to changes....

for (int count=0; count < numberOfEm         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-03 15:16

    for (int count=0; count < numberOfEmployees; count++)
        {
            cout << "Name: ";
           cin.getline (employees[count].name,100); 
    
            cout << "Title: ";
            cin.getline (employees[count].title,100); 
    
            cout << "SSNum: ";
           //error cin.getline (employees[count].SSNum); 
           cin>>employees[count].SSNum;
    
            cout << "Salary: ";
            // error cin.getline( employees[count].Salary);
            cin>>employees[count].Salary;
    
    
            cout << "Withholding Exemptions: ";
           //error cin.getline (employees[count].Withholding_Exemptions);
           cin>>employees[count]..Withholding_Exemptions;
        }
    

提交回复
热议问题