Create a program that:
- provides the initial input of integers and forms from them an ordered list;
- then remove negative numbers from the list and double the positive ones;
- the original and converted list should be displayed;
I myself have performed only the first item and then not completely, because I do not know how to arrange
#include "stdafx.h" #include <iostream> using namespace std; #define list struct spisok list {int info; list* next; }; list* head; list* first(int d) {list *t=new list; t->next=0; t->info=d; return t; }; void insert (list** s, int x) { list* t=*s; list* p=0; list *r; while(t!=0) { p=t; t=t->next; } r=first(x); if(p==0) *s=r; else p->next=r; }; void display(list *s) { list *t=s; while(t) { cout<<t->info; t=t->next; } }; int _tmain(int argc, _TCHAR* argv[]) {int x; cout<<"Vvedite 4isla"<<endl; cin>>x; head=first(x); do {cin>>x; insert(& head,x); } while(x!=0); display(head); return 0; }