خرید بک لینک

Vote count: 2

I am trying to write a simple program which will read two input lines, an integer followed by a string. However, it doesn't seem to work for me.

int main()
{
    int i;
    char str[1024];

    scanf("%d", &i);
    scanf("%[^n]", str);
    printf("%dn", i);
    printf("%sn", str);
    retu 0;
}

Immediately after entering the integer and pressing "Enter", the program prints the integer. It doesn't wait for me to enter the string. Whats wrong? Whats the correct way to program this?

asked 4 mins ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 19 فروردين 1395 ساعت: 14:19

صفحه بندی