I'm trying to store integer values in a boolean array, however when I print the values out, they only come out as 1's and 0's which I assume represent true and false. Is there any way to store values greater than 1 or less than 0 in a bool? Thanks in advance for the help! :D
Here's a sample of what I'm trying to do:
#include <iostream>
#include <string>
using namespace std;
int main(){
bool set[2];
set[0] = 7;
set[1] = 13;
string setNotation = "{"+to_string(set[0])+", "+to_string(set[1])+"}";
cout << setNotation << endl; //prints out as {1, 1} instead of {7, 13}
//note: I have to use to_string to append and not cout << "{" << set[0] << ...
//because I'm using this in a method that returns a string
return 0;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…