-
Notifications
You must be signed in to change notification settings - Fork 2
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
8ae1a4f
commit d85dcfb
Showing
4 changed files
with
122 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,14 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
|
||
using namespace std; | ||
|
||
int main(){ | ||
ifstream InputFile("FIRSTFILE.txt"); | ||
string s; | ||
while (getline(InputFile,s)){ | ||
cout << s << endl; | ||
} | ||
InputFile.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,28 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
|
||
using namespace std; | ||
|
||
int main(){ | ||
ofstream ofile1,ofile2; | ||
ofile1.open("FILE1.txt"); | ||
ofile1 << "7 2\n1 2 3 1\n2 2 4 1\n3 3 5 1\n"; | ||
ofile1.close(); | ||
ofile2.open("FILE2.txt"); | ||
ofile2 << "4 1 1 2\n5 2 2 2\n6 3 3 2\n7 4 4 2\n"; | ||
ofile2.close(); | ||
ifstream ifile1("FILE1.txt"); | ||
ifstream ifile2("FILE2.txt"); | ||
ofstream ofile3("FILE3.txt"); | ||
ofile3 << ifile1.rdbuf() << ifile2.rdbuf(); | ||
ifile1.close(); | ||
ifile2.close(); | ||
ofile3.close(); | ||
ifstream ifile3("FILE3.txt"); | ||
string s; | ||
while (getline(ifile3,s)){ | ||
cout << s << endl; | ||
} | ||
ifile3.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,42 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
|
||
using namespace std; | ||
|
||
int main(){ | ||
int n,m; | ||
cout << "Nhap n: "; | ||
cin >> n; | ||
cout << "Nhap m: "; | ||
cin >> m; | ||
ofstream ofile; | ||
ofile.open("MATRIX.txt"); | ||
ofile << n << " " << m << endl; | ||
for (int i=0;i<n;i++){ | ||
for (int j=0;j<m;j++){ | ||
cout << "Nhap a[" << i+1 << "," << j+1 << "]: "; | ||
int temp; | ||
cin >> temp; | ||
ofile << temp << " "; | ||
} | ||
ofile << endl; | ||
} | ||
ofile.close(); | ||
|
||
int a[1000][1000]; | ||
ifstream ifile("MATRIX.txt"); | ||
ifile >> n >> m; | ||
for (int i=0;i<n;i++){ | ||
for (int j=0;j<m;j++){ | ||
ifile >> a[i][j]; | ||
} | ||
} | ||
cout << "Mang hai chieu da nhap la: " << endl; | ||
for (int i=0;i<n;i++){ | ||
for (int j=0;j<m;j++){ | ||
cout << a[i][j] << " "; | ||
} | ||
cout << endl; | ||
} | ||
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,38 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
|
||
using namespace std; | ||
|
||
int main(){ | ||
int n; | ||
cout << "Nhap so phan tu cua mang: "; | ||
cin >> n; | ||
int a[n]; | ||
for (int i=0;i<n;i++){ | ||
cout << "Nhap phan tu thu " << i+1 << " cua mang: "; | ||
cin >> a[i]; | ||
} | ||
ofstream ofile; | ||
ofile.open("DATHUC.txt"); | ||
ofile << n << endl; | ||
for (int i=0;i<n;i++){ | ||
ofile << a[i] << " "; | ||
} | ||
ofile << endl; | ||
for (int i=0;i<n;i++){ | ||
ofile << a[i] << " x " << i; | ||
if (i!=n-1){ | ||
ofile << " + "; | ||
} | ||
else ofile << "." << endl; | ||
} | ||
ofile.close(); | ||
|
||
ifstream ifile("DATHUC.txt"); | ||
string s; | ||
while (getline(ifile,s)){ | ||
cout << s << endl; | ||
} | ||
ifile.close(); | ||
return 0; | ||
} |