数値 1009 を入力すると、これが実際のコードになりました。出力数値を 7687 にしたいのですが、これは問題ではありません。最後の cout ステートメントで、encryptnum を入力したときに 7687 を出力したいので、cout << first << second << third << four; を入力する必要はありません。
#include <iostream>
using namespace std;
int main()
{
int num;
int first;
int second;
int third;
int fourth;
int encryptnum;
cout << " Enter a four digit number to encrypt ";
cin >> num;
first = num % 100 / 10;
second = num % 10;
third = num % 10000 / 1000;
fourth = num % 1000 / 100;
first = (first + 7) % 10;
second = (second + 7) % 10;
third = (third + 7) % 10;
fourth = (fourth + 7) % 10;
encryptnum = //I want to make encryptnum print out first, second, third, and fourth
cout << " Encrypted Number " << encryptnum;
return 0;
}