Answer to Question #174378 in C++ for Jean Claude

Question #174378

a) Discuss the key components of a computer system, and how these components make it possible for computer users to effectively utilize computer system resources.


b) Compare and contrast the Windows operating system and the Unix/Linux operating system and briefly explain the features of each of these operating systems that makes it suitable for system programming.


c) Write a C/C++ program to create a file in a specified folder of the Windows file system, and write some text to the file. Compile and run the program and copy the source code into your answer booklet.


1
Expert's answer
2021-03-26T08:31:14-0400

The key function of an operating system to manage the resources of the computer such as CPU, storage device and other connected hardwares. it is also used to execute user interface between the user and the computer system using the softwareand the third function of an operating system is to execute and provide resources to any software or application running on the machine. All these functions when put together successfully utilise the system resources effectively by the first function of operating system that is used to manage the computer resources for various software applications for program and allocate them resources according to the need , making it effective for the operating system to control the resource sharing between the software application and operating system and by creating a user interface between the user and the system the user is also able to directly interact with the machine and allocate resources according to their preferences and need.

#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main( int argc, char* argv[] ){
ifstream inStream;
ofstream outStream;
for(int i=1; i < argc; i++){
cout << endl << argv[i];
fstream f;
f.open(argv[i]);


//inStream.open("menu1.txt");
// inStream.open("menu2.txt");
string item[10];
double cost[10];


// ifstream m1("menu1.txt");
//ifstream m2("menu2.txt");


string name;
double var;

string line;
istringstream iss(line);

short loop=0;
if(f.is_open()){

while(!f.eof()){
iss >> name >> var;
getline(f, line);
while(f>>name>>var){
item[loop]=name;
cost[loop]=var;
cout << endl << "Item at index " << loop << " " << item[loop];
cout << endl << "Cost at index " << loop << " " << cost[loop];
loop++;
}

}
cout << endl;

f.close();
}


}


return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS