Linked Questions

2493 votes
10 answers
1.1m views

Note: The answers were given in a specific order, and have received varying amounts of votes over time. Since the order of answers depends on your answer sorting preferences, here's an index of the ...
sbi's user avatar
  • 225k
657 votes
43 answers
1.5m views

I have to format std::string with sprintf and send it into file stream. How can I do this?
Max Frai's user avatar
  • 64.6k
737 votes
8 answers
1.4m views

Since ANSI C99 there is _Bool or bool via stdbool.h. But is there also a printf format specifier for bool? I mean something like in that pseudo code: bool x = true; printf("%B\n", x); which would ...
maxschlepzig's user avatar
  • 40.1k
156 votes
9 answers
71k views

Suppose I have a code like this: void printHex(std::ostream& x){ x<<std::hex<<123; } .. int main(){ std::cout<<100; // prints 100 base 10 printHex(std::cout); //...
UltraInstinct's user avatar
85 votes
5 answers
59k views

If it doesn't, do you know what compiler or version will? See cppreference/format.
PorssiMies's user avatar
7 votes
3 answers
4k views

I have a function to return a bool: bool restart() { std::string answer; bool answered = false; while(answered == false) { cout << endl << endl << "Do you ...
Jack Wetherell's user avatar
0 votes
4 answers
3k views

#include <iostream> #include <cmath> #include <string> using namespace std; string STRING; bool isEqual(double a, double b) { return fabs(a-b) ==0; } int ...
Henning Joubert's user avatar
1 vote
1 answer
1k views

bool one = true; bool two = false; bool three = true; bool four = false; cout << boolalpha; cout << "value of one : " << one << endl; cout << "value of ...
Luigi_2000's user avatar
0 votes
1 answer
2k views

I am a newbie at C++ and I got really stuck at this problem: When the user enters 2 numbers EX: 1 and 2 than the code has to figure out if the first number is grater or not from the first one, the ...
Lolechi's user avatar
  • 151
0 votes
2 answers
594 views

So I have a function called isEmpty() to check if a specified array has been filled with variables. bool isEmpty() const; This is: bool Array::isEmpty() const { if(elemData == NULL) ...
Joe of Loath's user avatar
0 votes
1 answer
1k views

I had to create a function that takes an integer parameter called number and the function would check to see if number is a prime number or not. Everything works but the output to the user would be a ...
Matthew's user avatar
  • 19
2 votes
2 answers
421 views

I need a macro that takes input as MACRO(x, y, z, ...) and expands to arr[0] == x && arr[1] == y && arr[2] == z ... Any ideas? arr is char[], and macro args are single chars
Jacob's user avatar
  • 23
0 votes
4 answers
121 views

I was trying to locate vector a in vector b. So it's like if vector a is in vector b then return true else false. And vector a should be like {1,2,3} and b should like {4,1,2,3,5,5,7}. The output of ...
user4032883's user avatar