C++ :: Utility That Converts Dollars To Coins
Sep 21, 2013
For the program, you will write a utility that converts dollars to coins. It is a simple program that must have the following:
-Multiple outputs to the screen
-At least one input
-The use of integers and strings
-Looking or repetition with Do..While, If..Else
-Must have some output text to show correct value of coins that would be converted from the dollars.
-Code must include comments explaining your reason for the code section or what the code is doing
-Code must compile
-Whole dollars only. If value is less than 1 or 0, the program should break or exit.
-Turn in your source code (.cpp file) to your instructor with your filename including your first and last name and your compiled executable.
View 3 Replies
ADVERTISEMENT
Jul 20, 2013
I know this is pretty basic script the problem I have is that I have to use functions for each calculation. The problem I face is that when the user types in the amount of quarters, dimes, nickels, and pennies when a function tries to add them together it displays a huge number instead of the right number.
Here is my code:
#include <stdio.h>
void insert_money(int p, int n, int d, int q, int total){
printf("How much of each coin do you want to insert:
");
printf("Quarters: ");
scanf("%d", &q);
[Code] ....
View 7 Replies
View Related
Mar 8, 2014
Write a program in C that will allow a user to enter an amount of money, then display the least number of coins and the value of each coin required to make up that amount. The twist to this program is the introduction of a new coin - the jonnie (value = $1.26). Therefore, the coins available for your calculations are: Twonies, Loonies, Jonnies, Quarters, Dimes, Nickels and Pennies. You can assume the amount of money user enters will be less than $100.00.
User enters $4.53. Your output should be:
The least number of coins required to make up $4.53 is 4. The coins needed are:
1 Toonie $2.00
2 Jonnies $2.52
1 Penny $0.01
$4.53
I'm wondering if i'm close. I'm stuck on what to do for the output. This is what i have so far.
Code:
//Start
#include <stdio.h>
int main() {
//Get user input for amount of money
//Input
int i;
//Store input from user
[Code] .....
View 3 Replies
View Related
Jul 25, 2013
I have two third party DLL files that I wanted to check if they are 32bit or 64. I searched the web and some suggested corflags, I found it under "C:Program Files (x86)Microsoft SDKsWindowsv7.0ABin" (my machine is 64bit but I didn't find the utility under "Program Files" folder), it came out with the message:
corflags : error CF007 : The specified file does not have a valid NT file header
Whats wrong with it?
View 4 Replies
View Related
Jun 9, 2014
Why certain projects always roll their own data structures/utililiy classes rather than using the C++ standard libraries? such as linked lists and queues? Is there a particular reason for this?
View 11 Replies
View Related
Nov 7, 2014
I am working on a number of utility functions for two dimensional arrays of integers, or matrices. However I am having a problem with segmentation faults, most likely due to errors in using malloc in functions like copyMatrix.
Code:
matrix_utils.h~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//This function checks if two matrices are equal
int isEqual(int **A, int **B, int n);
//This function returns one row of a matrix
int * getRow(int **A, int i, int n);
//This function returns one column of a matrix
int * getCol(int **A, int j, int n);
[Code] ....
View 2 Replies
View Related
Jan 30, 2013
I had the idea to write a program that would convert a decimal integer into any base up to 36 (there are no letters after that) so I decided to give it a try.
Code:
#include <stdio.h>
#include <stdlib.h>
char letters(int r); // prototypes function for converting 10's to A's and so on, base 11+ will work
int main() {
int base;
int d; //declares decimal integer
int d_clone; // clones d for a loop
[Code] ......
View 8 Replies
View Related
Apr 9, 2013
Task: - Write a function `index` that converts an int from 0 to 5 into its word. (It should take an int and return a string.)
0 -> "zero"
1 -> "one"
2 -> "two"
3 -> "three"
4 -> "four"
5 -> "five"
anything else -> "other"
#include <iostream>
using namespace std;
string index(int x) {
if(x=0)
return "zero ";
else if(x==1)
[Code] .....
It compiles but doesn't print anything.
View 4 Replies
View Related
Nov 16, 2013
I've reached a point in "Jumping into C++" where I need to make a program that converts input numbers into their word equivalent.
So far I've made it work for numbers 0-9999. I've tried implementing 10000-99999 but there are problems with the order of the words printed (57865 would print fifty thousand seven thousand eight hundred sixty five). But besides that, the program is absolutely enormous (for me) and I'm wondering if it can be shortened. Keep in mind I can only use loops and if statements so far. Here it is:
Code:
#include <iostream>
#include <string>
void extras(int e);
void digits(int x);
void tens(int xx);
void hundreds(int xxx);
void thousands(int xxxx);
//void tens_of_thousands(long xxxxx);
[Code]....
View 6 Replies
View Related
Jul 10, 2013
My program takes in an input file from the command line and converts the string from the file into a linked list and then depending on the command it will manipulate the string to either reverse the list, print the list, or take a character out...I'm having trouble taking a character out, my code compiles fine but doesn't change the string at all
Code:
#include <stdio.h>
#include <stdlib.h>
#define SIZE 1024
[Code]....
View 4 Replies
View Related
Mar 6, 2015
i m learning c programming and i m stuck with this program for some reason.Write a program that converts alphanumeric phone number into numeric form:
O/P:
Enter phone number: CALLAT 2255288
here is the code i have written:
/** compilers shows no error **/
and O/P I get is
Enter phone number: CALLAT
/**blank space***/
Code:
#include<stdio.h>
int main(void)
{
char ch;
printf("Enter phone number:");
ch=getchar();
}
[code]....
View 4 Replies
View Related
Feb 20, 2014
I have made a program that converts or reverses an input string. Here is my code working fine
static void Main(string[] args){
string input = Console.ReadLine();
string[] words = input.Split(' ')
for (int i = words.Length; i > 0; i--)
Console.Write(words[i - 1] + " ");
Console.WriteLine();
Console.ReadLine();
}
How can I write this program in pseudo code?
View 2 Replies
View Related