Using cin >>
Sample program: // sample program for cin #include <iostream.h> int main(void) { int fleas; cout << "How many fleas does your cat have?"; cin >> fleas; cout << "Well, that's " << fleas << " fleas too many!! \n\n\n"; return 0; } cin can accept more than one variable as follows: cout << "Enter an integer and a decimal:"; cin >> integer >> decimal; You would enter the values by typing on a single line and leaving a space between them, or by typing them on separate lines and hitting ENTER after each entry. |
No comments:
Post a Comment