Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following program is a function in one of my programs. It basically allows t

ID: 3631482 • Letter: T

Question

The following program is a function in one of my programs. It basically allows to change a part of an array, which happens to be a song name. The issue I'm having is with the getline. When the program runs it just skips over that line and just runs the rest of the program without letting me change the song. If anyone can help me figure out the issue that would be very much appreciated. Thanks!



void changeSong ()
{
int ix;
string newsong;
cout << "Enter the Index Number you would like to edit: ";
cin >> ix;
cout << endl;
cout << ix << " " << Song [ix] << " " << Artist [ix] << " " << Album [ix] << endl;
cout << "Enter the new song name: " ;
getline (cin,newsong);
Song[ix] = newsong;
cout << endl;
printDatabase();
}

 

also if i change the getline to just a regular cin >> newsong; it works, as long as the song name is only one word, so I know the issue is with that command

Explanation / Answer

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

u have included all the above ?

still it didnt work

please post your entire code so that we can debug /