Skip to main content
-5 votes
1 answer
145 views

How is the sum of three doubles not a double?! int main() { auto answer = 1.0 + 2.0 + 3.0; std::cout << answer; return 0; } output: 6 What?!
Mark Storer's user avatar
  • 15.9k
16 votes
2 answers
717 views

I have a program that reads the coordinates of some points from a text file using std::istringstream, and then it verifies the correctness of parsing by calling stream's operator bool(). In general it ...
Fedor's user avatar
  • 24.7k
5 votes
2 answers
220 views

In my application, I have a thread which just runs std::getline() constantly to get user input, to then send it to a server via a socket. I've made a signal handler to close the program properly when ...
PeasKeeper's user avatar
0 votes
0 answers
103 views

I have been thinking about this for some time now, I know what I want but I am not sure how to approach the solution. I have the following interface class class connection { protected: ... ...
Amirul I's user avatar
  • 319
1 vote
1 answer
79 views

When the t variable is within int bounds, getline input behavior is fine. but when the value given to t is out of int bounds, getline behavior is weird why so ? cin>>t; string s(10, '&'); ...
Rohith chidurala's user avatar
-1 votes
1 answer
233 views

I started with the easiest piece of code #include <iostream> using namespace std; int main() { cout << "Hello World!"; return 0; } I setup VScode to run C++ and this is ...
HIMYM's user avatar
  • 29
-4 votes
1 answer
140 views

The setprecision() function can display numbers based on significant digits or number of decimals. But I have found a problem using this. In particular, when I start using the "fixed" ...
SK90's user avatar
  • 79
0 votes
1 answer
79 views

My focus here shall be the following quote taken from the manual description of setvbuf, which startled me: If buffer is not a null pointer, instructs the stream to use the user-provided buffer of ...
Physina's user avatar
  • 13
2 votes
3 answers
149 views

I would like to implement a CHECK() function that can work like this: int a = 1; int b = 2; int c = 1; CHECK(a == b) << "check failed" << endl; // this will abort the program ...
Zeyu Zhang CN's user avatar
1 vote
0 answers
43 views

Using a book as a tutorial on C++ streams, I typed out the following code: //include std IO header #include <iostream> //start here int main() { int TypedLetter; std::cout << &...
Frank Scrooby's user avatar
-1 votes
1 answer
64 views

I want to make cin>> work in QT, so it's needed to use the external terminal, not the application output. I followed all the instructions given in the previous answers about cin>> not ...
Walter Balzarotti's user avatar
2 votes
1 answer
183 views

I have a simple class in C++20 that logs data to a file line by line for Windows platform. To ensure thread safety, I use a static std::mutex to serialize the write operations. However, I encounter an ...
İsa Yurdagül's user avatar
1 vote
1 answer
138 views

I want to read a binary file into a vector. Everything seems to work fine, since all the values have the correct values. Except the binary values/data isn't inputted into data or rather data isn`t ...
Schtraded's user avatar
4 votes
2 answers
2k views

I'm trying to compile StegHide from source and I got an error message, saying that iostream can't be found. I wrote the following program and compiled it with -std set to all standards that my system ...
ruChikati's user avatar
0 votes
0 answers
245 views

I'm new to coding, and our teacher advised us to use Visual Studio Code as our text editor, and also to follow YouTube tutorials on how to install Msys2 and the MinGW-w64 toolchain to use as a ...
altasgeorge's user avatar

15 30 50 per page
1
2 3 4 5
171