dimanche 3 mai 2020

cin to function arguments without variable

I want to pass user input directly to function without variable. Now I am doing this:

int temp, len;
cin >> len;
for (int i = 0; i < len; i++){
    cin >> temp;
    foo(temp);
}

Can I do it without temp? Maybe I should not use "cin"?

Aucun commentaire:

Enregistrer un commentaire