So, I am trying to write a c++ code that asks for a binary number and then after you can input the number you are looking for (IE 6125) and if it finds it inside of the binary number you input, it will show you the binary string that contains that number in the binary code you input this is what I have so far but am stumped as how to move forward
// ConsoleApplication3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;
int main()
{
string mystring;
mystring = "Enter the full Binary Code you wish for parsing";
cout << mystring << "\n";
cin <<
system("pause");
return 0;
}
wrote an altered code but I am getting errors that wont launch it. using visual studio for this
#include <iostream>
#include "stdafx.h"
using namespace std;
int main()
{
int n, c, k;
cout << "enter a number to be converted into binary";
cin >> n;
cout << "the binary number is";
for (c = 31; c >= 0; c--)
{
k = n >> c;
if (k & 1)
cout << "1";
else
cout << "0";
1>------ Build started: Project: ConsoleApplication3, Configuration: Debug Win32 ------
1>ConsoleApplication3.cpp
1>c:\users\cschneider\source\repos\consoleapplication3\consoleapplication3\consoleapplication3.cpp(9): error C2039: 'string': is not a member of 'std'
1>c:\users\cschneider\source\repos\consoleapplication3\consoleapplication3\predefined c++ types (compiler internal)(208): note: see declaration of 'std'
1>c:\users\cschneider\source\repos\consoleapplication3\consoleapplication3\consoleapplication3.cpp(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\cschneider\source\repos\consoleapplication3\consoleapplication3\consoleapplication3.cpp(9): error C2143: syntax error: missing ',' before '&'
1>c:\users\cschneider\source\repos\consoleapplication3\consoleapplication3\consoleapplication3.cpp(12): error C2039: 'all_of': is not a member of 'std'
these are the errors I get all the way down and I am not sure why I am getting them