0
私は文字列入力を受け取り、各文字番号を3つ上に移動した文字列を出力しました。文字列の最後には%
という文字しか印刷されません。printfの最後の不要な文字
#include <iostream>
#include <stdio.h>
#include <string>
int main()
{
std::cout << "Input message: " << std::endl;
std::string mes;
std::cin >> mes;
for(char& c : mes)
{
printf ("%c", c+3);
}
}
これは、プログラムの使用と出力されます:
Input message:
hi
kl%
のstd :: coutのとprintfの? OK、どうしてですか? – Treycos
@krzaq nice find。 – xaxxon