// I am extremely bad at c++ and my class is giving me hell this semester and my instructor will not email me back to assist me with anything ive been doing poor on most of my recent assignments i started out good if some one could fix what i am doing wrong and perhaps write // comments explaining what i did wrong and what it should look like this would help me out alot this assignment hits alot of really confusing areas for me on the if while and for loops i will paste what i got followed by the algorithm i am supposed to be going by..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

const int MAXADS = 100;
int adcatcode[MAXADS];
int adwords[MAXADS];
int numads;
int i;
int j;
int k;
int subtotal;
int temp;
cout << " please enter the number of ads;" cin>> numads;
if(numads > 0 + numads<=[MAXADS])
for(i=0; numads1); i++)
cout << "Please enter Advertisement Catagory code " << i + 1 << " Category Code (115):" << endl;
cin >> adcatcode[i];
cout << "Please enter number of words for the advertisment:" cin>> adwords[i]; endl;
for(i=0; numads2);//really confused from this point on i think...
for(j=0; numads2);//
for (temp = [j]); ([j] =[j+1]) ([j+1]; = temp) (temp = [j] = j+1 =temp);
endl;
cout << "total word counts sourted by category code" cin..
cout << "===============================" cin>>
int k=0
while(k<=numads1);(subtotal = 0 + curCode= adcatcode[k]) +(k<=numads1);(subtotal=subtotal+adwords[k]);
endl;
else(cout"number adds requested less than 1 or is too large:ad limit is" cin>> MAXADS);
system("PAUSE");
Return EXIT_SUCCESS;
 
// this is my algorithm i am to go by..
// Pseudocode PLD Chapter 8 #7 pg. 350
// Start
// Declarations
// num MAXADS = 100
// num adcatcode[MAXADS]
// num adwords[MAXADS]
// num curCode
// num numads
// num i
// num j
// num k
// num subtotal
// num temp
// output "Please enter the number of ads: "
// input numads
// if ((numads > 0) and (numads <= MAXADS))
// for i = 0 to numads  1
// output "Please enter Advertisement Category Code (1  15): "
// input adcatcode[i]
// output "Please enter number of words for the advertisement: "
// input adwords[i]
// endfor
// for i = 0 to numads  2
// for j = 0 to numads  2
// if (adcatcode[j] > adcatcode[j+1])
// temp = adcatcode[j]
// adcatcode[j] = adcatcode[j+1]
// adcatcode[j+1] = temp
// temp = adwords[j]
// adwords[j] = adwords[j+1]
// adwords[j+1] = temp
// endif
// endfor
// endfor
// output "Total Word Counts Sorted By Category Code"
// output "========================================="
// k = 0
// while k <= numads  1
// subtotal = 0
// curCode = adcatcode[k]
// while ( (curCode = adcatcode[k]) and (k <= numads  1) )
// subtotal = subtotal + adwords[k]
// k = k + 1
// endwhile
// output "Category: ",adcatcode[k  1], " ","Word Count: ", subtotal
// endwhile
// else
// output "Number adds requested less than 1 or is too large; ad limit is ", MAXADS
// endif
// Stop
//any help with this would be appreciated its a long shot but if someone could spend the time to explain each part i did wrong in comment // or a method of choice to do so i would be grateful for any and all help thanks guys and gals