これは、対象とするのポインタ文字列の配列を作っ概要
3例があります。
彼らは、書き込みのさまざまな方法を表しています
私のコンパイラは、Visual Studio 2019コミュニティです
これは最初の段落です標準のC言語の言葉遣い
#include <iostreamの> する#include <STDLIB.H> する#include <stdio.hに> する#include <math.h>の 使用 名前空間をSTD。 INT のmain() { int型のI。 char型の P [ 12 ] [ 30 ] = { " 1月"、" 2月"、" 月"、" 4月"、" 月"、" 6月"、" 7月"8月" " 9月" " 10月" " 11月" " 12月" }; のprintf(" 入力してください今月のあなたの数:" ); cinを >> 私; のchar * ; = P [ 12 ]; のprintf (" \ n個" ); のprintf(" 月がある:%sの\ nは"、*(P + I - 1 )) return0; }
第二段落C ++言葉遣い
#include <iostreamの> する#include <STDLIB.H> する#include <stdio.hに> する#include <math.h>の 使用 名前空間をSTD。 INT のmain() { int型のI。 const のchar * P [ 12 ] = { " 月"、" 月"、" 月"、" 月"、" 月"、" 月"、" 月"、" " 9月" " 10月" " 11月" " 12月" }; のprintf(" 入力してくださいあなたの月の数:" ); cinを >> 私は、 printfの(" \ n個" ); のprintf(" 月である:%S \ n "、P [I- 1 ]); return0; }
第三段落があるC ++言葉遣い
#include <iostreamの> する#include <STDLIB.H> する#include <stdio.hに> する#include <math.h>の 使用 名前空間をSTD。 INT のmain() { int型のI。 const のchar * P [ 12 ] = { " 月"、" 月"、" 月"、" 月"、" 月"、" 月"、" 月"、" " 9月" " 10月" " 11月" " 12月" }; のprintf(" 入力してくださいあなたの月の数:" ); cinを >> 私は、 printfの(" \ n個" ); のprintf(" 月である:%S \ n "、* P + I- 1 ); return0; }