+ 1
Complete the class code
#include <iostream> using namespace std; class GPIO { //Complete the code here . . . . . }; int main() { GPIO ardunio(0b11011111); cout << arduino.digitalRead(0) << endl; //should print out the LSB: 1 https://code.sololearn.com/csOjOyLQ7BY8/?ref=app
1 Odpowiedź
+ 2
this is the one :
#include <iostream>
using namespace std;
class GPIO
{
string strInput;
public :
GPIO(string str)
{
strInput = str;
}
char digitalRead(int i)
{
if(i==0)//lsb
{
return strInput[strInput.length()-1];
}
}
};
int main()
{
GPIO ardunio("0b11011111");
cout << ardunio.digitalRead(0) << endl; //should print out the LSB: 1
return 0;
}