viết chương trình đọc tệp bt.txt chứa 2 số thực trên 2 dòng .tính tổng 2 số thực đó và ghi ra màn hình 21/08/2021 Bởi Parker viết chương trình đọc tệp bt.txt chứa 2 số thực trên 2 dòng .tính tổng 2 số thực đó và ghi ra màn hình
var a,b:real; begin assign(input,’bt.txt’); reset(input); readln(a); read(b); close(input); write(a+b:0:4); readln end. Bình luận
#include <iostream>#include <fstream>using namespace std;int main(){ double a,b; ifstream inp(“bt.txt”); inp>>a>>b; cout<<a+b; inp.close(); //samon247 return 0;} Bình luận
var a,b:real;
begin
assign(input,’bt.txt’);
reset(input);
readln(a);
read(b);
close(input);
write(a+b:0:4);
readln
end.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
double a,b;
ifstream inp(“bt.txt”);
inp>>a>>b;
cout<<a+b;
inp.close();
//samon247
return 0;
}