This commit is contained in:
w65567 2022-05-10 14:33:11 +02:00
parent edca2d6ea6
commit 27c3768c07
3 changed files with 40 additions and 2 deletions

View File

@ -139,7 +139,7 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ConsoleApplication1.cpp" /> <ClCompile Include="ConsoleApplication2.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -15,7 +15,7 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ConsoleApplication1.cpp"> <ClCompile Include="ConsoleApplication2.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

View File

@ -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();
}