mercredi 15 avril 2015

Scanf using \n. Don't know what does it do

I am new to programming and I can't figure out what is happening. This is my code:



#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
int c,d;
scanf("%d\n", &c);
cout<<c<<endl;
return 0;
}


I can't understand why it's taking two inputs and printing the first one out.


Aucun commentaire:

Enregistrer un commentaire