Ok, so mailings is a no go. Long story short: you can't replace multiple text instances in word with text from multiple cells in excel in one document. Also, it takes too long to open and start messing with mailings in word every time a set of PMs is assigned to me as opposed to an online C++ compiler.
Anyway, here's the good news:
#include <iostream>
using namespace std;
int main()
{
string x, y, z;
cin >> x >> y >> z;
string a[3] = {x, y, z};
string output[] =
{
"",
"",
"1)PM#",
x,
"",
"SAP ID ",
"___________________________",
"",
"LAT/LONG ",
"________________________________",
"",
"ADDRESS: ",
"_____________________________________",
"",
"",
"",
"2)PM# ",
y,
"",
"SAP ID ",
"___________________________",
"",
"LAT/LONG ",
"________________________________",
"",
"ADDRESS: ",
"_____________________________________",
"",
"",
"",
"3)PM# ",
z,
"",
"SAP ID ",
"___________________________",
"",
"LAT/LONG ",
"________________________________",
"",
"ADDRESS: ",
"_____________________________________" ,
"END"};
int i = 0;
while (output[i] != "END")
{
cout << output[i++] << endl;
}
return 0;
}
Here's the last issue, though:
the user will select a set of PMs (usually 20, sometimes 10) that looks like this:
35287385
35287387
35287389
......
...
(there's actually no spaces between them unlike in my original post)
then copy them directly from the email
then r-click paste into the black output screen, not individually, but the whole set of 20 or 10 PMs at once.
I need the program to assign however many PMs have been pasted into individual elements in the array.
That way the user doesn't have to tell the program how many PMs they're inputting each time.
I am not sure if I miss sth. but your code looks awfully complicated.
I think you need only one template and one loop to process all the numbers.
Make sure you compile with -std=c++11 or higher
Try to run this code and see how it works:
There seems to be a problem with the windows console when you paste multiple lines of text - at least on my Windows 8.1.
You need to do better than "doesn't work".
What doesn't work?
- it doesn't compile - if not, post your error messages
- it doesn't run - show us what you tried
- the output is wrong - again, how is that different to your expectation.