BLODAS Posted May 24, 2012 Report Posted May 24, 2012 Din fisierul tema.in, se citesc numere intregi de pe mai multe randuri (maxim 5000). Afisati in tema.out numerele citite in ordine crescatoare cate 10 pe linie(ultima linie poate sa aiba mai putine)PLS HELP
BogdanNBV Posted May 24, 2012 Report Posted May 24, 2012 (edited) http://cplusplus.com Ai tot ce-ti trebuie acolo Input/Output with files - C++ Documentationistream::getline - C++ Reference Edited May 24, 2012 by BogdanNBV
Guest demisec Posted May 24, 2012 Report Posted May 24, 2012 iti fac schema, te descurci cu implementarea.while(f>>n)pui nr in vector.ordonare vector. (bubble sort)for(i=1;i<=n(nr de vectori);i+=10){for(j=1;j<=10;j++)g<<v;g<<endl}daca nu reusesti nici acum, filologie
BLODAS Posted May 24, 2012 Author Report Posted May 24, 2012 ce am facut pana aici e bun?#include<stdio.h>#include<iostream.h>FILE*f,*g;int n,i,j,a[1001],int main(){f=fopen("tema.in","r");while(!feof(f)){n++;fscanf(f,"%d",a[n]);}fclose(f);g=fopen("tema.out","w");for(i=1;i<=n;i+=10){for(j=1;j<=10;j++)g<<a;g<<endl}
R3AL Posted May 24, 2012 Report Posted May 24, 2012 #include <fstream>#include <vector>int main(){ std::ifstream in("tema.in"); std::vector<int> nr; while(1) { int t; in>>t; nr.push_back(t); if(in.eof()) break; } in.close(); std::ofstream out("tema.out"); for(int i=0;i<nr.size();i+=10) { for(int j=i;j<i+10;j++) { if(j>nr.size()-1) break; out<<nr[j]<<" "; } out<<std::endl; } out.close();}
BLODAS Posted May 24, 2012 Author Report Posted May 24, 2012 mersi de efort, apreciez dar trebuia iostream si stdio...
R3AL Posted May 24, 2012 Report Posted May 24, 2012 (edited) mersi de efort, apreciez dar trebuia iostream si stdio...De ce?edit: oh, nu stiam Edited May 24, 2012 by R3AL
Guest Kovalski Posted May 24, 2012 Report Posted May 24, 2012 De ce?pentru ca e clasa a 9-a?pentru ca nu folosesc librariile alea la scoala?guess
bcman Posted May 24, 2012 Report Posted May 24, 2012 pentru ca e clasa a 9-a?pentru ca nu folosesc librariile alea la scoala?guessEu sunt a noua ?i tot fstream folosesc. La olimpiad?, to?i pe care îi ?tiu folosesc tot fstream.
Guest demisec Posted May 24, 2012 Report Posted May 24, 2012 se folosesc in majoritatea cazurilor. eu asa am invatat intr-a 9a, asa era la olimpiada, asa e in modelele de atestat/bac
BLODAS Posted May 24, 2012 Author Report Posted May 24, 2012 daca va spun ca e numai iostream si stdio la noi trebuie sa intelegeti...apreciez efortul
BLODAS Posted May 24, 2012 Author Report Posted May 24, 2012 cer TC nu mai are rost ma pis pe ea de info
DarkyAngel Posted May 24, 2012 Report Posted May 24, 2012 v?d c? vrei s? te pi?i ?i pe regulament, având în vedere c? ai f?cut de vreo 3 ori 2x / 3x post..
Starker Posted May 24, 2012 Report Posted May 24, 2012 Daca nu sti asta, o amarata de citire si afisare acum pe la sf lu a 9... e grav rau... mai bine te muti... nu e de joaca cu info in a 10... sa nu mai zic de a 11 si a 12...
Guest Kovalski Posted May 24, 2012 Report Posted May 24, 2012 deschizi topic, ceri ajutor, dupa care te pisi pe el ?+ dublu post + triplu post + limbaj de circ pe chat.+ postat la programare cand de fapt trebuia la ajutor.ban 1 zi + topic closed + trash
aelius Posted May 24, 2012 Report Posted May 24, 2012 (edited) Ba, ce sloboz de scoala faceti ma acum ? Cu jumatea de porc si damigeana de vin. Intrii aici, te ajuta baietii si tot tu esti tare-n gura. Pisa-te-ai caramizi si placi de azbociment.ban 1 zi + topic closed + trashCe o zi bre ? Ban permanent ! de la nasul mare. Edited May 24, 2012 by aelius