int main(){ tPeople people[h]; int n, head = 0, quantity = h; Inserting(people); printf("\n"); Printing(people, quantity); do{ do{ printf("\nType a number: "); scanf("%d", &n); }while(n < 1); Eliminating(people, n - 1, &head, &quantity); Printing(people, quantity); }while(quantity > 1); printf("\nThe winner was: %d - %s\n", people[0].id, people[0].name); return 0; }
int main(){ head=NULL; printf("How many numbers you want to enter?"); int i,n,x; scanf("%d",&n); for(i=0;i<n;i++){ printf("Enter the number you want to enter"); scanf("%d",&x); Insert(x); Printing(); } }
int main(){ struct Node* head=NULL; printf("How many numbers you want to enter?"); int i,n,x; scanf("%d",&n); for(i=0;i<n;i++){ printf("Enter the number you want to enter"); scanf("%d",&x); Insert(&head,x);//passing address of head Printing(head); } }
void main () { setlocale(LC_ALL,"ru"); srand(time(NULL)); k++; system("cls"); do { cout<<" M E N U "<<endl; if(k<2) cout<<" 1 - создание массива "<<endl; else if(k>1) { cout<<" 2 - удаление "<<endl; cout<<" 3 - доавление "<<endl; cout<<" 4 - на какое число увеличить элементы массива "<<endl; cout<<" 5 - сортировка "<<endl; } cin>>choice; if(choice<1 || choice>5) cout<<"..."; _getch(); system("cls"); }while(choice<1 || choice>5); if(vars>0 && choice !=1) { Printing(K,ROW,COL); } if(choice==1){ do { cout<<" 1 - вручную "<<endl; cout<<" 2 - автоматически "<<endl; cin>>vars; if(vars<1 || vars>2) cout<<"..."; _getch(); system("cls"); }while(vars<1 || vars>2); InitMass(K,ROW,COL); } else if(choice==2 || choice==3){
int Reading(){ _Bool wasLongWord = false; ////_Bool wasPartWord = false; _Bool wasNotPrinted = false; int lastWordStart; int j = 0; while(1){ //printf("while\n"); int readed = read(0, inBuf + filled, size - filled); if ( readed == 0) { if(wasNotPrinted){ outBuf[j] = '\n'; Printing(outBuf, j + 1); } //printf("readed 0"); return 0; } else { //printf("Was Not Printed false\n"); wasNotPrinted = false; } int curLen = filled + readed; //printf("curLen:%d+%d\n", filled , readed); int cWord = 0; int i = 0; for(i = 0; i <= curLen - 1; ++i) { j = 0; while( (inBuf[i] != '\n') && (i <= curLen - 1) ) { outBuf[j] = inBuf[i]; ++j; ++i; } if(inBuf[i] == '\n' && i <= curLen - 1 ){ ++cWord; if(!wasLongWord){ //printf("Addet str end.\n"); outBuf[j] = '\n'; lastWordStart = i + 1; Printing(outBuf, j + 1); filled = 0; } else { wasLongWord = false; lastWordStart = i + 1; } j = 0; } else { --i; if(cWord == 0) { if(curLen == size){ //printf("Long word detected\n"); wasLongWord = true; filled = 0; j = 0; }else{ ////wasPartWord = true; filled = i + 1; //printf("Was Not Printed true\n"); ////wasNotPrinted = true; } } else { //printf("Part word detected\n"); //printf("copy part word to begi of buf\n"); int z; for(z = 0; lastWordStart + z <= curLen -1; ++z){ inBuf[z] = inBuf[lastWordStart + z]; //printf(" %d", inBuf[z] - '0'); } filled = size - lastWordStart; //printf("Filled = %d \n", filled); //printf("Was Not Printed true\n"); wasNotPrinted = true; } } } } return 1; }