Page 1 of 1

uit.cpp #include #include #include using namespace std; int main() ifstream input_file("circ

Posted: Mon Mar 21, 2022 4:47 pm
by answerhappygod
Uit Cpp Include Iostream Include Fstream Include Iomanip Using Namespace Std Int Main Ifstream Input File Circ 1
Uit Cpp Include Iostream Include Fstream Include Iomanip Using Namespace Std Int Main Ifstream Input File Circ 1 (119.63 KiB) Viewed 58 times
Uit Cpp Include Iostream Include Fstream Include Iomanip Using Namespace Std Int Main Ifstream Input File Circ 2
Uit Cpp Include Iostream Include Fstream Include Iomanip Using Namespace Std Int Main Ifstream Input File Circ 2 (105.71 KiB) Viewed 58 times
i have written the code correctly and created the file but the compiler is not showing the results please tell me what to do???????
uit.cpp #include<iostream> #include<fstream> #include<iomanip> using namespace std; int main() ifstream input_file("circuit.txt"); ofstream output_file("results.txt"); output_file<<left<<setw(7)<<"voltage"<<"\t"«<left<<setw(7)<<"current"<<"\tpower"<<endl; double voltage, current; > while (!input_file.eof()) { input_file> voltage >>current; output_file<<left<<setw(7)<<voltage<<"\t"<<left<<setw(7)«<current<<"\t"; if (voltage>10|| current>10) I { output_file<<"H"<<endl; continue; } double power=voltage* current; output_file<<power<<endl; } input_file.close(); output_file.close(); return 0; Compile Log Debug Find Results Close

View his PC > Documents > C++ circuit results