Results 1 to 8 of 8
Thread: C++
Hybrid View
-
28th December 2014 14:10 #1
C++
,
, . , main . , :
.Code:void all(struct poletiStruct pl[]) { SetConsoleOutputCP(1251); int i = 0; long pos; poletiStruct p; cout << "\n : \n"; fp.open(flights, ios::binary | ios::in); if (!fp) { cout << "\n !" << endl; exit(1); } fp.seekg(0L, ios::end); pos = fp.tellg(); fp.seekg(0L, ios::beg); for (i = 0; i<pos / (sizeof(poletiStruct)); i++) { fp.read((char*)&p, sizeof(poletiStruct)); pl[i] = p; cout << "\n : " << pl[i].PoletN; cout << "\n 2015 (1-31): " << pl[i].Den; cout << "\n : " << pl[i].Ime; cout << "\n : " << pl[i].BrP1; cout << "\n : " << pl[i].BrP2; cout << "\n : " << pl[i].CenaB1; cout << "\n : " << pl[i].CenaB2; cout << "\n=================================\n"; } fp.close(); }
.
.Code:const char flights[] = "poleti.txt"; const int N = 30; struct poletiStruct { string Ime; unsigned int PoletN; short unsigned int BrP1; short unsigned int BrP2; float CenaB1; float CenaB2; unsigned int Den; }; int n; fstream fp;
-
28th December 2014 14:58 #2
, char ime[40];
ASRock B85 Pro4, Pentium G3240, DD3 8GB/1333MHz, 120GB SSD + 1TB + 640GB HDD
Gigabyte GV-R657OC-1GI, CM B500, ASUS 24B1S1, LCD SAMSUNG SM931BW, 173
-
28th December 2014 15:16 #3
, . getline(cin, pl[i].Ime) cin.getline(pl[i].Ime, 40) .
Last edited by deathfall; 28th December 2014 at 16:43.
-
28th December 2014 16:19 #4
cin.getline(pl[i].Ime, 40) 40 ,
, :
cin.getline(pl[i].Ime, 255);
pl[i].Ime[39]=0;Last edited by ined; 28th December 2014 at 16:58.
ASRock B85 Pro4, Pentium G3240, DD3 8GB/1333MHz, 120GB SSD + 1TB + 640GB HDD
Gigabyte GV-R657OC-1GI, CM B500, ASUS 24B1S1, LCD SAMSUNG SM931BW, 173
-
28th December 2014 18:40 #5
-
28th December 2014 19:20 #6
, fstream - , .
ASRock B85 Pro4, Pentium G3240, DD3 8GB/1333MHz, 120GB SSD + 1TB + 640GB HDD
Gigabyte GV-R657OC-1GI, CM B500, ASUS 24B1S1, LCD SAMSUNG SM931BW, 173




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in