What am I doing wrong with this one. I'm a beginner

Write a program that takes as input any change expressed in cents. It should then compute the number of half-dollars, quarters, dimes, nickels, and pennies to be returned, returning as many half-dollars as possible, then quarters, dimes, nickels, and pennies, in that order. For example, 483 cents should be returned as 9 half-dollars, 1 quarter, 1 nickel, and 3 pennies

#include <iostream>
// using namespace std;

int=(change, half_dllars, quarters, nickels, pennies;
input number)
int halfDollars = input / 50;
input = input % 50
int quarters = input /25
input = input % 25
int dimes = input / 10
input = input % 10
int nickles = input / 5
input = input % 5
int pennies = input
input = input

cout>>("Your amount is divided as: 11%d half_dollars, 1%d quarters,0%dimes 1%d nickels and 3%d cents"),
(half_dollars, quarters,dimes,nickels, change);

cout<< "press q and then Enter to quit-->>";
char dummy;
cin>> dummy;                        // Wait for input
  return 0 ;
8 Years
Discussion Span
Last Post by Ancient Dragon

line 5: remove the open parentheses after =.

line 8: replace close parentheses with a semicolon

lines 9-17: you can not put the calculations here because the value of input is not yet known.

line 20: its a big mess :) you are mixing c's printf() format specification with c++ -- you can't do that. Forget the %d specifier. Format the text like this example:

cout << "half_dollars = " << setw(11) <<  halfDollars << "\n";

You never did prompt for data input and use cin to get the values from the keyboard.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.