list

input : 3 4 5 5 0
output : 4: 3 4 5 5

#include<iostream>
#include<list>
#include<string>

using namespace std;
int main()
{
list<int> intList;
list<int>::iterator it;
int count=0;
int x;
cin>>x;
while (x!=0)
{
intList.push_back(x);
cin>>x;
count++;
}

cout<<count<<" : ";
for(it=intList.begin(); it!=intList.end();it++)
cout<<" "<<*it;
cout<<"\n";


return 0;

}
This is your 5th post in the past hour. Stop Fucking spamming. If you double-tripple-fripple-5tipple post again, Im gonna remove all of your posts.

Edit: Ive removed two of your posts becuase they're identical. Ive told you to use code tags, otherwise its hard to read code - http://www.cplusplus.com/articles/jEywvCM9/
Last edited on
Topic archived. No new replies allowed.