mercredi 25 février 2015

Simple coding to Stack


int main()
{

string sentence;
int length;


cout << "Enter the sentence now." << endl;
getline(cin, sentence);


for(int i = 0; i < sentence[i]; i++)
{



if(sentence[i]==';')
cout<<" ";
else if(sentence[i] != ' ')
{
cout << sentence[i];
}
else if(sentence[i] == ' ')
{
cout << endl;
}

}
}


I need help in this code to change into stack coding method. At least you can show me some clue how to change this code into simple stack code.


Aucun commentaire:

Enregistrer un commentaire