answersLogoWhite

0

AllQ&AStudy Guides
Best answer

cin and cout are not operators, they are objects. cin is console input while cout is console output (explicitly idintified as std::cin and std::cout). In other words they are the C++ standard library stream objects that represent stdin and stdout respectively. The corresponding std::cerr stream represents stderr, the console error stream. std::cerr is typically directed to the screen while std::in and std::cout are also typically directed to the screen but can be redirected via the command line when executing the binary executable.

This answer is:
Related answers

cin and cout are not operators, they are objects. cin is console input while cout is console output (explicitly idintified as std::cin and std::cout). In other words they are the C++ standard library stream objects that represent stdin and stdout respectively. The corresponding std::cerr stream represents stderr, the console error stream. std::cerr is typically directed to the screen while std::in and std::cout are also typically directed to the screen but can be redirected via the command line when executing the binary executable.

View page

You are probably referring to the global std::cout object, however std::cout does not put information on a screen, it puts information into the standard console output device which can be redirected to any output device the user chooses (the screen, a file, a line-printer, the nul device, etc).

View page

Use a multiset to sort the input automatically.

int main()

{ std::multiset<int> set;

int i;

while (std::cin >> i)

set.insert (i);

for (auto it=set.begin(); it!=set.end(); ++it)

std::cout << i << std::endl;

}

View page

Blood test-full spectrum for stds. You can usually get these free, they are done for aids prevention but screen all.

View page

#include<iostream>

#include<fstream>

#include<string>

struct record

{

std::string title;

std::string artist;

};

std::ostream& operator << (std::ostream& os, const record& r)

{

return os << r.title << '\n' << r.artist;

}

std::istream& operator >> (std::istream& is, record& r)

{

getline (is, r.title);

getline (is, r.artist);

return is;

}

int main()

{

std::ofstream ofs;

ofs.open ("test", std::ios::binary);

record out1 {"Master of Puppets", "Metallica"};

record out2 {"Permanent Waves", "Rush"};

ofs << out1 << std::endl;

ofs << out2 << std::endl;

ofs.close();

std::ifstream ifs;

ifs.open ("test", std::ios::binary);

record in1, in2;

ifs >> in1 >> in2;

ifs.close();

std::cout << "Record 1:\n" << in1 << std::endl;

std::cout << "Record 2:\n" << in2 << std::endl;

}

View page
Featured study guide

What causes syphilis

What role do the following play in educating the public against the spread of the HIV Virus the government the church the home

Why do people take drugs that are not for medical reasons

What is the most common curable STD in young sexually active women

➡️
See all cards
No Reviews
More study guides
5.0
1 Review

No Reviews
Search results