5A_5
This commit is contained in:
parent
edca2d6ea6
commit
27c3768c07
|
@ -139,7 +139,7 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ConsoleApplication1.cpp" />
|
||||
<ClCompile Include="ConsoleApplication2.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ConsoleApplication1.cpp">
|
||||
<ClCompile Include="ConsoleApplication2.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class File {
|
||||
fstream f;
|
||||
string imie;
|
||||
public:
|
||||
void czytajDane() {
|
||||
getline(cin, imie);
|
||||
}
|
||||
|
||||
void zapisz() {
|
||||
f.open("dane.txt", ios::app);
|
||||
f << imie << endl;
|
||||
f.close();
|
||||
}
|
||||
|
||||
void wypisz() {
|
||||
f.open("dane.txt", ios::out);
|
||||
string temp;
|
||||
while (!f.eof()) {
|
||||
getline(f, temp);
|
||||
cout << temp << endl;
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
File a;
|
||||
a.czytajDane();
|
||||
a.zapisz();
|
||||
a.wypisz();
|
||||
}
|
Loading…
Reference in New Issue