-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94b2d90
commit 7b686f3
Showing
5 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
lkdfjiosadfa | ||
fjkafijdaof | ||
fjasifhusai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
#include <string> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
fstream file("./dane.txt", ios::in | ios::out | ios::app); | ||
if (!file.is_open()) { | ||
cout << "Nie udalo sie otworzyc pliku" << endl; | ||
return 1; | ||
} | ||
|
||
string line; | ||
while (getline(file, line)) { | ||
cout << line << endl; | ||
} | ||
|
||
file.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <fstream> | ||
#include <vector> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
fstream file("imona_nazwisko.txt", ios::in | ios::out | ios::app); | ||
if (!file.is_open()) { | ||
cout << "Błąd otwarcia pliku" << endl; | ||
return 1; | ||
} | ||
|
||
vector<string> first_names; | ||
vector<string> last_names; | ||
string firstName, last_name; | ||
|
||
while (file >> firstName >> last_name) { | ||
first_names.push_back(firstName); | ||
last_names.push_back(last_name); | ||
} | ||
|
||
for (int i = 0; i < first_names.size(); i++) { | ||
cout << first_names[i] << " " << last_names[i] << endl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <fstream> | ||
#include <vector> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
fstream file("imona_nazwisko.txt", ios::in | ios::out | ios::app); | ||
if (!file.is_open()) { | ||
cout << "Błąd otwarcia pliku" << endl; | ||
return 1; | ||
} | ||
|
||
vector<string> first_names; | ||
vector<string> last_names; | ||
vector<string> grades; | ||
string firstName, last_name, grade; | ||
|
||
while (file >> firstName >> last_name >> grade) { | ||
first_names.push_back(firstName); | ||
last_names.push_back(last_name); | ||
grades.push_back(grade); | ||
} | ||
|
||
float sum = 0; | ||
for (int i = 0; i < first_names.size(); i++) { | ||
cout << first_names[i] << " " << last_names[i] << " " << grades[i] << endl; | ||
sum += stof(grades[i]); | ||
} | ||
cout << "Średnia: " << sum / grades.size() << endl; | ||
|
||
file.close(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Anna Nowak | ||
Jan Kowalski | ||
Maria Wiśniewska | ||
Piotr Kwiatkowski |