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

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=n; i=0; 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: if (i%2 != 0){ cin &gt;&gt; name ; cout &gt;&gt; name ;} else { cin &gt;&gt;name ; names.push(name);} } while (names.isEmpty()){ cout &gt;&gt;; 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