Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <set>
- using namespace std;
- //template <typename T>
- /*T kvadrat(T a){
- return a*a;
- }*/
- int main()
- {
- vector <int> a;
- int b;
- vector <int> :: iterator I;
- I = a.begin();
- for (int i=0; i<5; i++){
- cin >> b;
- if (b >= 0){
- a.push_back(b);
- while(I != a.end()){
- I++;
- cout << *I << endl;
- }
- cout << endl;
- }
- else{
- a.insert(I, b);
- while(I != a.end()){
- I++;
- cout << *I << endl;
- }
- }
- }
- /*set<int>a;
- set<int>::iterator I;
- int b;
- for (int i = 0; i < 1; i++){
- cout << "введите число: " << endl;
- cin >> b;
- a.insert(b);
- }
- while(true){
- cout << "введите число: " << endl;
- cin >> b;
- if (a.find(b) == a.end()){
- a.insert(b);
- }
- else{
- cout << "число "<< b << " есть" << endl;
- }
- }*/
- /*I = a.begin();
- cout << *I << endl;
- I++;
- cout << *I << endl;
- I++;
- cout << *I << endl;
- I++;
- if (I == a.end()){
- cout << "end" << endl;
- }*/
- //cout << kvadrat(5.7) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement