Hey everyone, I'm new to C++ programming and have just started the semester and having a bit of trouble with my second homework assignment. Here's the assignment: Write a program that accepts a 7-9 digit integer andechoes the number with commas between every three
digits from the right. Here's what I have so far:
#include <iostream>
using namespace std;
int main() //Needed in every program, where program execution begins
{
int number;
cout << "Please enter a 7 to 9 digit number" << endl;
cin >> number;
cout << "The number you entered is: " << number << endl;
return 0;
}
As you can see from my code above that my issue comes in when it comes to placing the commas. Would I use an if statement and mod division? I don't want you to do my homework, I want you to point me in the right direction. Thanks in advance for the help.