int main ()
{
int num; //for integer number
int wives; //for number of wives
int child; //for number of children
int dog; //for number of dogs
int pup; //for number of puppies
std::cout << "Enter Citizen’s ID:\n"; // for integer number
cin >> num = num + num; // get the sum and assign it to num
cin >> wives = num - num; //num (sum) – num (integer number)
std::cout <<"Number of wives:\n";
cin >> child = num - wives; //num (sum) – wives
std::cout <<"Number of children:\n";
cin >> dog = num - child; //num (sum) – child
std::cout <<"Number of dogs:\n";
cin >> pup = num - dog; //num (sum) – dog
std::cout <<"Number of puppies:\n";
return 0 ;
}
hey guys,,
Uhmm..
when i try to build this,, it says cin was not declared in this scope..
what will i do to fix this??
Try std::cin.
Further more, your cin calls seem a bit odd. Could you perhaps clarify what this program as a total is supposed to do? Since std::cin is used for user input, meaning they can type in a value which will be assigned to a data member. You're currently trying that AND changing the value with a = operator. I haven't the faintest idea what you're trying to achieve.
In the land of Chicano, each male citizen is identified by an integer number. The same number will
tell the number of wives, the number of children per wife, the number of dogs per child, and the
number of puppies per dog of that person. For example, citizen number 6 has 6 wives with 6 children
per wife; 6 dogs per child; and 6 puppies per dog. Make a program that would input the citizen's ID
(integer number) and then output the total number of wives, children, dogs, and puppies of that
citizen.