1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Brilliant_brown [7]
4 years ago
12

What is the missing If condition in the following code fragment? The program is supposed to halt if the input file does not exis

t. ifstream inFile; inFile.open("myfile.dat"); if ( ) { cout << "Cannot open input file." << endl; return 1;
Computers and Technology
1 answer:
nikklg [1K]4 years ago
8 0

Answer:

The missing part is

if ( !inFile )

Explanation:

The full codes are as follows:

  1.    ifstream inFile;
  2.    inFile.open("myfile.dat");
  3.    if ( !inFile )
  4.    {
  5.        cout << "Cannot open input file." << endl;
  6.        return 1;
  7.    }
  8.    return 0;

Given that inFile is an ifstream object. When inFile is used to open "myfile.data", there will be possibility where myfile.dat is not available. If so, !inFile will be interpolated as true in the if condition and generate the message "Cannot open input file". This is one very simple way to check if the file exist when we try to read it from our program.

You might be interested in
I can't solve this <br> Python loop with while statement
sasho [114]

Answer:

what just use something called google.

Explanation:

8 0
3 years ago
Read 2 more answers
12. When computer professionals take on jobs, they may not enter into relationships with which of the
weeeeeb [17]

Answer:

12 is c. 13 is a .14 is c 15 I don't know sorry

6 0
3 years ago
Which is worse: Fast charging (Due to heat) or unplugging before reaching full capacity (On a normal charge)?
Ray Of Light [21]
Unplugging before reaching Capacity
4 0
4 years ago
If you want a user to actively participate in an online activity, create a web ______________.
elena-14-01-66 [18.8K]

If you want a user to actively participate in an online activity, create a web ______________.  

1. animation  

2. application  

<u>3. page  </u>

4. source

6 0
3 years ago
Read 2 more answers
What is the magnitude of the largest positive value you can place in a bool? a char? an int? a float? a double??
Elena L [17]
The <span>magnitude of the largest positive value you can place in a bool, a char, an int, a float, a double are as follows:

</span><span>Int: 4 bytes Float: 4 double: 8 char: 1 boolean: 1
</span>
I hope my answer has come to your help. God bless and have a nice day ahead!
8 0
4 years ago
Other questions:
  • Few people will care if you use their image in a photograph without obtaining their consent. True False
    10·1 answer
  • Reflexes are basically "hard-wired" into the CNS. Anatomically, the basis of a reflex is an afferent neuron that synapses direct
    10·1 answer
  • What is the "host" in a typical email address?
    14·1 answer
  • I WILL MARK BRAINLIEST PLZ HELP
    5·1 answer
  • Digital dashboards provide the decision makers with a quick overview of key performance indicators and other key operational sta
    13·1 answer
  • To support continuous improvement efforts in the workplace, you increase the number of tasks that an employee performs and have
    7·1 answer
  • You are having problems on your Windows 7 computer and you pull up Device Manager to see if there are any alerts. Two of your de
    11·1 answer
  • What video game has made the most money as of 2016?
    15·2 answers
  • Select the correct answer.
    10·1 answer
  • Have all of my coins because i will delete acount there will be part 2, 3 , 4 ,5,6,7,8
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!