can you please help me figure out my mistakes? #include <iostream> #include <fst
ID: 674471 • Letter: C
Question
can you please help me figure out my mistakes?
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
char ltr ;
double F , A ,B ,C ,D ;
cout<<"Enter aletter and 4 number ? "<<endl;
cin>> ltr >> A >> B >> C >> D ;
F={(A+B)/(D%C)*(A+2)};
cout<<"you can reading from k ?"<<endl<<" A= "<< A <<" B= "<<B<<"C="<<C<<"D="<<D<<endl;
cout<<" F= "<<F<<endl;
cout<<" thank you "<<endl;
system ("pause");
ifstream ("reem.txt")
ofstream outfile("reem.out")
infile >>ltr >> A >> B >> C >> D ;
F={(A+B)/(D%C)*(A+2)};
out<<"the number are A= B= C= D= "<<A<<B<<C<<D<<endl;
outfile.close();
}
Explanation / Answer
Below are the errors in your code
cout> ltr >> A >> B >> C >> D // ">/>>" operators are invalid for cout. It should be cin istead of cout.
Correct version : cin>> ltr >> A >> B >> C >> D ;
cout>ltr >> A >> B >> C >> D // Again ">>" is invalid for cout. It should be <<
out<<"the number are A= B= C= D= "< // out is invalid keyword in c++ It should be cout. And in last '<' this operator is also invalid. Either you need to remove it or use it properly.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.