You are not logged in. Please login at www.codechef.com to post your questions!

×

How to take input from user in multiset in C++. Following in not working. Please help me.

0
1

while ((N--)!=0 && cin>>input) multiset1.insert(input);

asked 20 Jan, 12:12

baapji's gravatar image

2★baapji
01
accept rate: 0%


Here is the accepted one,For the multiset Take a look below.

include < iostream >

include < set >

using namespace std; int main() { multiset< int >multiset1; int N,i; cin>>N; int input; while((N--)!=0 && cin>>input) { multiset1.insert(input);
} multiset<int>::iterator itr = multiset1.begin(); while (itr != multiset1.end()) { cout << *itr++ << endl; }
return 0; }

For Given N value:

3   -> Given N value
1
2
3
    Printing Elements in multiset1. 
1
2
3

link

answered 20 Jan, 12:30

siva140191's gravatar image

3★siva140191
1335
accept rate: 12%

edited 20 Jan, 13:07

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×159

question asked: 20 Jan, 12:12

question was seen: 63 times

last updated: 20 Jan, 13:07