2017-08-24 9 views
-6

私はここにこだわっているとは思えませんが、これを乗り越えることはできません。 文の途中にlongの整数を入れたいと思います。Cのprintf()関数

この出力が表示されます。

Howdy, I am 166662 
Process returned 0 (0x0) execution time : 0.019 s 
Press any key to continue 

私はこれを実行するためにコードブロックを使用しています。

#include <stdio.h> 

int main(){ 
    long mn = 166662; 
    printf("Howdy, I am %ld",mn,"i hope that you had a better better day than I having.\n"); 
    return 0; 
} 
+3

printf仕様を読んでください:最初の書式文字列、次にパラメータ。 – Yunnosch

+2

'' Howdy、私は%ld " - >' "Howdy、私は%ld。%s" ' – BLUEPIXY

+1

[' printf'のドキュメントを読む](http://en.cppreference.com/w/ cpp/io/c/fprintf)。このようには動作しません。 – tadman

答えて

3

printf仕様を読んでください:最初の書式文字列、次にパラメータ。

#include <stdio.h> 

int main(){ 
    long mn = 166662; 
    printf("Howdy, I am %ld i hope that you had a better better day than I am having.\n", mn); 
    return 0; 
} 
+0

ああ、私は完全に忘れてしまった...:/あなたの助けをありがとう。 – chumned

+0

@chummed、私はあなたにも 'man'のページを読む方法を忘れてしまった、あるいはSOを汚染する前にちょっとした研究をする方法を忘れているとしか思えません...疑わしい内容:-)いつかガイドラインを読んでください彼らはここであなたの時間をできるだけ痛みのないものにするでしょう。 – paxdiablo