Questions tagged [cout]

std::cout is the global stream object provided by the C++ standard library for writing to the standard output stream.

For more general questions about std::ostream use the or tags.

Bjarne Stroustrup, the creator of C++, explains that cout is pronounced "see-out" and the "c" stands for "character".

1674 questions
-1
votes
1 answer

Printing error in cout

I have a variable which is divided into 3 and 5 bits, and i am able to populate to each section i.e a and b. unsigned char a:3,b:5; How can i print the values of both the section individually. If not how can I print as a whole. cout << a << b…
Dilip Kumar
  • 1,711
  • 10
  • 22
-1
votes
1 answer

C++ code not doing what I want

When I call this function it doesn't display any *. But when I change == to < it works. Why? void starBox(int size){ for(int i = 0; i == size; i++){ for(int j = 0; j == size; j++){ cout << '*'; } cout <<…
-1
votes
2 answers

c++ print row and column names in 2 dimensional array

Just wondering if it is possible to print the names of the rows and columns in a 2 dimensional array? What I have is a seating plan with 13 rows named Row1 -> Row13 and the columns are letterd A -> F ... I can get the seating plan to display no…
Raj
  • 31
  • 1
  • 2
-1
votes
2 answers

Only first letter in array text file displays

Working on a program for my C++ course. I'm not sure where I am going wrong or what I am missing. I have an array in a text file (seating.txt) that shows a seating plan for an airplane. I need to be able to display the seating but can only seem to…
Raj
  • 31
  • 1
  • 2
-1
votes
1 answer

Inconsistency with std::cout - failing to print on specific numbers

I'm running a program to factorise a large number, which outputs each factor it finds as it goes through, smallest to largest. It works fine for numbers below the 1 billion mark, as far as I have tested, but I get a very strange bug when I input…
Monty Evans
  • 59
  • 1
  • 8
-1
votes
3 answers

How does cout << (i > 0); makes it equal to 1?

in the statement, cout << (i>0), where i is positive, and greater than 0, how much of an impact does (? > 0) have to always (as far as I have tested) output 1? #include using namespace std; int main() { int i = 2, j = 5; double…
-1
votes
1 answer

Tic-Tac-Toe BIG board using functions and 2D arrays

I've tried solving this problem for over a week. My assignment is to cout (display) a big tic-tac-toe board that looks like this: 0000 | 1111 | 2222 0000 | 1111 | 2222 0000 | 1111 | 2222 0000 | 1111 | 2222 ------------------ 3333 | 4444 | 5555 3333…
Vanidad Velour
  • 37
  • 1
  • 1
  • 6
-1
votes
1 answer

cout/cin not reading or printing

I'm probably not using cin correctly here, but can someone tell me why this small program will not run and produce any output? #include using namespace std; class Vector { public: Vector(int s) :elem{new double[s]}, sz{s} {} …
Andrew Hummel
  • 351
  • 1
  • 5
  • 17
-1
votes
1 answer

Normal variable getting printed but its instance in structure is printing "$"

// function which populates the value of currentTemp and maxTemp result = smartHlpTemperatureGet( &sh, ¤tTemp, &maxTemp ); // Adding maxTemp and currentTemp to the structure after gettin diskDataT->currentTemp =…
Vinay Shukla
  • 1,751
  • 9
  • 34
-1
votes
3 answers

cout error while using functions

I've encountered a problem while trying to create a code which converts decimal numbers to binary, using functions. At first I created the code using only main function and it worked fine, but decided to modify it to use function. I believe code is…
bezirganyan
  • 382
  • 4
  • 15
-1
votes
1 answer

c++ weird result from showing lettters from cout

I'm new to programming and I started reading some c/c++ books to understand better. So i'm not very newbie and i will go straight to the subject. I want to make a program that show all the letters from a to z, so i made 2 programs. One in C and…
user3134909
  • 131
  • 2
  • 7
-1
votes
5 answers

For loop and eliminating repetition

Geeting! I'm working on a console application which read in numbers put them in an array and the output tells you those numbers position in the array where the number is larger then 1000. so if you have an array like this : int be[] = { 1001, 1001,…
-1
votes
1 answer

Create and include a header file with function declarations then a source file with definitions then another source file with calls to functions

So I am running through some C++ exercises courtesy of Bruce Eckel the idea here is that I am trying to create a header file with some function declarations then include that header file into a source file in which I create some definitions for…
-1
votes
1 answer

cout.setf(ios::fixed) and cout << fixed do not seem to get the same result?

this is my sample main : double hours = 35.45; double rate = 15.00; double tolerance = 0.01000; cout.setf(ios::scientific); cout << "Scientific notation: " << endl; cout << "hours = " << hours << ", rate = " << rate << ", pay = " << hours *…
-1
votes
1 answer

std::cout printing forbidden system info to the console

I have a c++ program which runs continuously and in order to debug it I print some values to the console using cout. This has been working fine for the past week. Now however, after about 30 seconds it will print information that it should not have…
Fat-chunk
  • 341
  • 2
  • 14
1 2 3
99
100