I have a empty vector that I need to fill with binary numbers 1 and 0, and when user inputs something other then 0 and 1 the size of vector is complete. I tried something like this:
#include "pch.h"
#include <iostream>
#include <vector>
using namespade std;
bool task1() {
vector<int> binV
int input = 0;
for (int i = 0; i < binV.size; i++) {
cout << "Enter binary number: " << " ";
if (input == 1 && input == 0) {
cin >> input;
binV.push_back(input);
}
else {
cout << "Wrong input, the size of vector is complete";
}
}
return 0;
}
int main() {
task1();
}
I made simple loop for inputing and made this if/else statement which is incorrect I presume but didn't find solution to my task and I ran into code problems C2446 and C3867 which I don't understand since I'm not expert in C++
Aucun commentaire:
Enregistrer un commentaire