My code doesn't work

Why doensn't my 2. scan work? :(

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>

using namespace std;

int main()
{
    int x=0;
    printf("Transformations\n");
    printf("%d\n", x);
    scanf("Enter an x integer", &x);
    printf("%d\n", x);
    scanf("Enter a new x integer", &x);
    printf("%d\n", x);
    return 0;
}
You need to add the formatting piece to your scanf calls:

http://www.cplusplus.com/reference/cstdio/scanf/?kw=scanf

closed account (E0p9LyTq)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>

int main()
{
   int x=0;

   printf("Transformations\n");
   printf("%d\n", x);

   printf("\nEnter an x integer: ");
   scanf("%d", &x);
   printf("%d\n", x);

   printf("\nEnter a new x integer: ");
   scanf("%d", &x);
   printf("%d\n", x);

   return 0;
}
Thanks for the replies. I completely forgot about that :)
No problem! Good luck! And please check this as answered.
Topic archived. No new replies allowed.