I submitted a soda machine problem earlier that had 25 error, I have made some corrections, but I still have 6 errors. Can anyone help.

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int getcoins ()

{
int total = 0, number;
cout << "put in coins: ";
while (total < 65)
{
cin >> number;
if (number == 100 || number == 25 || number == 10 || number == 5)
total += number;
if (total < 65) cout << "add more coins:" << endl;
}

return total;
}

//function to see if selection is available bool checkselection (char * machine, char select)
int main ()
{
int machine;
int select;
bool isavailable = false;
for (int i = 0; i < 9; i++)
if (*(machine +i) == select) isavailable = true; //check if c s or d is available *(machine + i) = ' '; //change selected item to space to initiate that it is gone return isAvailable;
}

{
int array "machine = ??ne char [10]
*(machine + 0) = 'c';
*(machine + 1) = 'c';
*(machine + 2) = 'c';
*(machine + 3) = 's';
*(machine + 4) = 's';
*(machine + 5) = 's';
*(machine + 6) = 'd';
*(machine + 7) = 'd';
*(machine + 8) = 'd';

cout << "\t\t **********************" << endl;
cout << "\t\t\tTony's HIP POP SODA MACHINE" << endl;
cout << "\t\t **********************" << endl << endl

cout << "make selection c for Coke, s for Sprite, d for Dr. Pepper:";
cin >> select;
if ('checkselection (machine, select)
cout << "your chnage is " << change << "cents:" << endl;


cout << getcoins() << endl;


return 0;
}

Use arrays rather than pointers when you can, they're simpler. And watch that accidentally putting stuff at the end of a comment when you wanted in the code. You did that a few times, it was confusing. And use \n (newline character, yes it's one character, so '\n' is valid) in a string to do the same thing as endl, it's more convenient most of the time.

#include<iostream>
using namespace std; // a little simpler, but the same thing
 
int getcoins ()
{
  int total = 0, number;
  cout << "Put in coins: ";
  while (total < 65)
  {
    cin >> number;
    if (number == 100 || number == 25 || number == 10 || number == 5)
      total += number;
    else
      cout << "Bad coin.\n"; // added a way to indicate it didnt accept the entered value
 
    if (total < 65)
      cout << "Total so far: " << total << "\nAdd more coins: "; // added total so far
  }
  return total;
}
 
//function to see if selection is available 
bool checkselection (char machine[], char select) // seperate your comments and functions,
                                                  // the compiler was including the function name in the comment
{
  // took out declarations for machine and select, they're declared in the function parameters
  bool isavailable = false;
  for (int i = 0; i < 9; i++)
  { // added brackets ( {} ) for the for loop
    if (machine[i] == select) // when you have more than one statement under one if, they have to be in {}
    {
      isavailable = true; //check if c s or d is available
      machine[i] = ' '; //change selected item to space to indicate that it is gone
      break; // exits the for loop so that only 1 letter is ' 'ed per selection
    }
  }
  return isavailable; // changed isAvailable to isavailable, capitals matter, your first declaration had none
}
 
int main()
{
  char machine[10] = {'c','c','c','s','s','s','d','d','d'}; //whoa, whered you get that other stuff
 
  while(true) // added this loop so that you can get more than one soda be4 the program ends (which is the end of main() )
  {
    int change = getcoins() - 65; // never called getcoins(), declared change, or stored anything in change, so there it is 
                                  // keep in mind the program runs at main(), not the first function declared
 
    char select; // you didn't declare this variable
 
    cout << "\n\t\t **********************\n"
         << "\t\tTony's HIP POP SODA MACHINE\n"
         << "\t\t **********************\n\n"
         << "make selection c for Coke, s for Sprite, d for Dr. Pepper: ";
 
    cin >> select;
 
    if ( checkselection (machine, select) ) // got rid of the ' and added the last )
      cout << "\nHere's your soda, your change is " << change << " cents.\n\n\n"; // unimportant typo
    else
      cout << "\nNo more of that type left.\n\n\n"; // added that, I thought it was appropriate
 
 
    //got rid of  cout << getcoins() << endl;  as theres no need to call getcoins() again
 
  }
  return 0;
}

This compiles perfectly, although never ends. You just close the window to, umm, close it. Try to make it not steal your money when what you wanted isn't left, and try having a way to end it inside the program. Just small ways to take it a little farther. If you did this just to see if you could, good try, don't stop, and I encourage you to keep trying new things and learn from your mistakes. Programming is really fun.

I don't know how to put fancy colors in the code, oh well. Feel free sum1 to tell me.

Thanks for your help. This is the only programming class I had to take. BOY I'm not a programer LOL.

This question has already been answered. Start a new discussion instead.