Rewrite the following code, using only if statements (NO \"else\"). There is an
ID: 3852152 • Letter: R
Question
Explanation / Answer
The code written without else statement is as follows:
bool a=false, b =false;
int c=0, d=0;
<......>
if(a==true && b==false && c==1 && d==0)
{
using(StreamWriter writer1=new StreamWriter("C:OutputWrite1.txt"));
Console.SetOut(writer1);
Console.WriteLine("True");
}
if(a == false && b==true && c==0 & d==1)
{
using(StreamWriter writer2=new StreamWriter("C:OutputWrite2.txt"));
Console.SetOut(writer2);
Console.WriteLine("False");
}
The error in the file accessing portion was that we were not implementing the using keyword in the program where we are witing each file from a directory.The above code is the orrect code for the following given bases.
Please rate the answer if it helped......Thankyou
Hope it helps...
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.