# C++ Program The question asks for a program to ask user to enter eight digits. I am trying to create

C++ Program

The question asks for a program to ask user to enter eight digits. I am trying to create a loop to go back to question if it is not an eight digit integer but I cant seem to figure it out. Below is what I have, the bold italics line is what I am having a problem with. Please help, Thank you!

// Part 1: Fine the middle two digits

#include <iostream>

using namespace std;

int main () {

cout << “Part 1” << endl;

int a;

int k=a%100000;

k=k/1000;

cout << “Please enter an eight digit integer: “;

cin >> a;

if ((a < 9999999) && (a > 99999999)) cout << “Value not in range.”;

else cout << “The middle two digits are: ” << k << endl;

if ((k%3==0) && (k%7==0)) cout << k << ” is divisible by 3 and 7″ << endl;

if ((k%3!=0) && (k%7==0)) cout << k << ” is divisible by 7 and not 3″ << endl;

if ((k%3==0) && (k%7!=0)) cout << k << ” is divisible by 3 and not 7″ << endl;

cout << endl;

// Part 2: Identify Leap Years

cout << “Part 2” << endl;

int year;

cout << “Leap year” << endl;

cout << “Please enter a year: “;

cin >> year;

if (year%4==0) cout << “It is a leap year.” << endl;

else cout << “This is NOT a leap year.” << endl;

cout << endl;

return 0;

}