Я действительно новичок в программировании (я изучаю C ++). Может кто-нибудь сказать мне, почему я получаю это сообщение об ошибке при попытке запустить этот кусок кода.
int main()
{
auto days=0, hours_worked=0;
cin >> "days"; // This is where I get the error message.
cout << "Days worked per week";
cin >> "hours_worked"; // This is where I get the error message.
cout << "Hours worked per day";
cout << "This week Paul worked: "<<"6*9"<< endl;
return 0;
}
#include <iostream>
using namespace std; //we are going to use std::cin, std::cout, std::endl from the header file <iostream>
int main()
{
int days=0, hours_worked=0; //why not just declare it as integer?
cin >> days; //you need to write it without "" otherwise its treated as a string and not a variable
cout << "Days worked per week" << days; //no. of days the person worked
cin >> hours_worked; // same here
cout << "Hours worked per day" << hours_worked;
cout << "This week Paul worked: "<< (days*hours_worked) << " hours" << endl; //paul worked (days*hours_worked) hours
return 0;
}
исправленный код надеюсь, вы понимаете исправления.