lab4 - cin >> name ; if (((i%2) !=0)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <stack> #include <iostream> #include <string> using namespace std; int main(){ stack<string> names; int n; int setNum=1; string name; cin>> n ; cout<<"SET "<< setNum << endl; while (n != 0){ for (int i=1; i !=n+1; i++){
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cin &gt;&gt; name ; if (((i%2) !=0) ){ cout &lt;&lt; name &lt;&lt; endl ; } else { names.push(name); } } n=0; while (names.empty()==false){ cout &lt;&lt; &lt;&lt; endl; names.pop(); } setNum++; cin &gt;&gt; n ; } }...
View Full Document

This note was uploaded on 05/03/2011 for the course CSCI 180 taught by Professor Goldwasser,m during the Fall '08 term at Saint Louis.

Ask a homework question - tutors are online