Skip to main content

Questions tagged [cout]

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

-1 votes
1 answer
65 views

Singly linked list returning an error even though I have already checked it [closed]

When using a singly-linked list, I've been suggested to use "if x != nullptr" but I don't understand why this works. In my example code, the first and second print statements work, but as ...
Tenacity's user avatar
0 votes
0 answers
37 views

What form is a floored or "ceilinged" double when cout represenation has no decimal point and looks like an int? [duplicate]

I wanted to know how to floor a double and I found my solution in this question. I decided to experiment so I wrote the code below. #include <iostream> #include <cmath> using namespace ...
heretoinfinity's user avatar
2 votes
1 answer
102 views

Why does memcpy result in an unexpected value?

#include <iostream> #include <cstring> #include <bitset> using namespace std; int main() { double tx = 0xFFFF0000FFFF0000; uint64_t tx1 = 0; static_assert(sizeof(...
Handrix's user avatar
  • 23
0 votes
0 answers
45 views

Is there a function or operator I can use to save the state of the text cursor and then "call" the cursor to "load" to the position saved? [duplicate]

cout << "\n4. How much does an " << item << " weigh in " << unit << "? Type here: "; cout.flush();//promt is displayed immediately cout <&...
InfoCorsair's user avatar
-1 votes
0 answers
45 views

Functions involving other classes? [duplicate]

Currently I have two classes, the student and roster class. The roster class has an array of pointers that point towards the memory addresses of student class objects. Each student class has multiple ...
droid's user avatar
  • 31
1 vote
1 answer
134 views

What are the next steps to debug why nothing I'm trying to print is displaying in my terminal? [duplicate]

I'm using Visual Studio Code to work through a C++ course and am trying to finish a section challenge. Problem is, none of my cout are displaying anything. In both of my functions as well as my main ...
cavlier145's user avatar
2 votes
2 answers
105 views

C++ cout print order compared to C printf [duplicate]

I have two "equivalent" programs in C and in C++ that have different outputs. They should print step by step all the powers of a "base" between 0 and "exp" test.c is: #...
Francesco Antropoli's user avatar
0 votes
3 answers
72 views

I don't understand why cin worked differently depending on when I took the input [duplicate]

I was solving the hacckerrank challenge Arrays Introduction. It was a very simple question. The input was two lines. The first had size of the integer and the second line had the integers separated by ...
pk27's user avatar
  • 13
0 votes
1 answer
115 views

string_view<uint8_t>

I have a big vector of bytes, and I want to take a part of it, interpret these bytes as ASCII characters written in hexadecimal system and print this substring on the screen. I don't need a copy, so I ...
razenkovv's user avatar
0 votes
1 answer
69 views

C++ VS Code SFML no cout statements are printed to the terminal

I am using C++ in VS Code, I have a simple SFML project. For some reason, when I compile and run my program, none of my cout statements are printed to the terminal window in VS Code. The SFML window ...
Julian42_74's user avatar
0 votes
0 answers
73 views

I don't understand why my integer values are changing in C++ [duplicate]

My code is the following (C++) and returns 0, 8, and then 0 for each integer. I have no idea why? #include <iostream> int main(){ int earth; std::cout << earth << '\n'; int fire; ...
NDepth's user avatar
  • 11
-2 votes
1 answer
86 views

regarding error in getting output from cout

Error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'node') #include <iostream> using namespace std; class Node { int data; ...
Shivay Gupta's user avatar
1 vote
1 answer
109 views

C++ Error invalid operands to binary expression ('ostream' (aka 'basic_ostream<char>') and 'const std::chrono::year_month_day')

can you help me resolve this error invalid operands to binary expression ('ostream' (aka 'basic_ostream') and 'const std::chrono::year_month_day') I compile the source code with CLion 2023.3.2 C++ ...
GiuCom's user avatar
  • 15
1 vote
0 answers
31 views

Unexpected behavior of std::cout following std::wcout [duplicate]

Can anyone figure out why the second output (line 5) in the following program does not print anything? #include <iostream> int main() { std::wcout << L"Hello World\n"; std::...
apostol's user avatar
  • 87
0 votes
0 answers
21 views

Disable `std::cout` but keep Unity prints on embedded device which prints over SWO/USART

We are doing some testing directly on the embedded device and are printing "custom formatted" test results over USART or SWO using std::cout. Our embedded device uses a custom definition of ...
71GA's user avatar
  • 1,323

15 30 50 per page
1
2 3 4 5
123