THIS IS WHAT I HAVE SO FAR............ ....
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
struct Machine
{
string Drink_name;
float cost;
int num_drinks;
};
struct Machine drink[] = {{"coke", .75, 20}, {"A and W", .75, 20}, { "sprite", .75, 20},
...
User Profile
Collapse
-
thanks that was helpful.
QUESTION: i ask the user to input how much money they will enter into the machine, then am suppose to give back to them the change or if they didnt put enough money give back how much to put in.
first i did a loop for the menu choice. then i asked the user to pick a drink.
if they enter 1 they picked coke. but what i dont know is how to use the amount the user inputs and subract the cost of coke...Leave a comment:
-
program to simulate a soft drink machine
Write a program that simulates a soft drink machine. The program should use a structure that stores the following information:
Drink name
Drink cost
Number of drinks in machine
The program should create an array of five structures. The elements should be initialized with the following data:
Drink Name Cost Number in Machine
Coke .75 ... -
thanks for the reply, but am still confused. i kind of knew this part. what i dont understand is how the array ties in to this. i understand the different parts of the program i just dont know how am suppose to make it work together as one....Leave a comment:
-
Arrays, Structures, Functions.......helpppppp!!!
please everyone feel free to respond.
am posting an assignment that i was given in lab. i have been working on this for two days now. am not aking for the solution, I need serious guidance. i can write the structure but i get stuck when writing the functions. this the assignment below.
In this assignment, you will write a complete C++ program that simulates a small student... -
i know the user as to input a value. i will compare other values to this value. what i dont understand, is in int main() once i declare a variable and ask the user to input a number. how do i then compare this number to subsequent numbers the user will input. how do i call the function from main?
Desperatly trying to understand. Thanks for the replies....Leave a comment:
-
-
that's what i couldnt figure out. how do i pass in an argument?...Leave a comment:
-
Functions
I have to write this program this program:
Write a function called CountIt that has as an argument an integer value. this function will ask the user to enter 10 integers, and will count the number of values entered by the user that are less than the argument passed. if the numbers are LESS, the function returns a 0.
i know i have to write a count controlled loop, but i dont know how to do that with a function. I just... -
I cant use loops because it hasnt been taught in class. so i have to write the program using only if statements. i will post what i have so far in a few minutesLeave a comment:
-
-
am stuck here because i don't know how to begin the positive, negative and sum counts. i keep getting errors messages...Leave a comment:
-
i still trying to figure this out. i dont know how to to count the positive or negative and compute the sum at the same time. i feel stuck. we haven't been taught how to do any if this in class but we were given this assignment for homework. i have been working on this for hours so if someone could just please show me a sample of how this would work. i dont understand the array concept. this assisgment is due in the morning. please help me out.Leave a comment:
-
also i don't understand what you mean by array how do i do that.Leave a comment:
-
thanks for the reply. am writing the program now but when i try to read the numbers into my input the compiler gives me an error message. this is what i have so far.
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int one, two, three, four, five, six, seven, eight, nine, ten;
int positivecount, negativecount, sumneg, sumpos;
...Leave a comment:
-
c++n program
write a program that reads data from a file whose name is given by the user and then outputs to another file called myoutput.txt. the input file contains 10 numbers-the output file will contain data on each of the 10 numbers broken up into the following categories:
A of how many numbers are positive
A listing of all the numbers
A count of how many numbers are negative
A sum of all the positive numbers
A sum of...
No activity results to display
Show More
Leave a comment: