C++ :: Display Pizza Price By Size After User Input

Mar 13, 2014

How can i write a program that allows a user to enter a size of pizza and then print the price for that size.

Example: if a user enters size ''s'' then it should display the price stored under ''s''

View 3 Replies


ADVERTISEMENT

C++ :: User Array Size And Sorting User Input

Nov 1, 2014

I am making program that allows the user to determine how big the array size will be and then asks the user to make up numbers to fill the array. Every time run the program on Dev C++ it says "program has stopped working"

Heres My Code:

//Assignment 19 Program 2
#include <iostream>
using namespace std;
int main()

[Code].....

View 3 Replies View Related

C/C++ :: Menu Won't Show Display Entire Price?

Apr 15, 2014

I am working on a drink machine simulation. I have a text file that holds the prices, names and inventory. My problem is It won't let me set my prices at 1.00 or higher. Ex: I set the price to 1.50 in the text file then when it reads the info and stores the price it only stores .50 instead of 1.50.

my code:

#include <iostream>
#include <string>
#include <fstream>

[Code].....

View 1 Replies View Related

C/C++ :: Menu Won't Show Display Entire Price

Apr 15, 2014

I am working on a drink machine simulation. I have a text file that holds the prices, names and inventory. My problem is It won't let me set my prices at 1.00 or higher. Ex: I set the price to 1.50 in the text file then when it reads the info and stores the price it only stores .50 instead of 1.50.

textfile looks like this:
Apple Juice 1.50 20
Mango Juice 1.50 20
Sprite Mix 1.90 20
Coca Cola 1.90 20

[Code].....

View 2 Replies View Related

C++ :: Char Array Size - Undefined Until User Input

Apr 27, 2014

So I'm trying to make a program, Which has nothing to do with the topic. But I ran into a problem.

I need to get a char array size of 6 doing:

char myChar[6];

but the size (6) is undefined until user input.

So I need to do char myChar[var]; (Var being 6 for now).

When I do:
char myChar[6];
It works!!!

But when I do:
int val = 6;
char myChar[val];
It doesn't work.

View 3 Replies View Related

C++ :: Build Array Of A Size After Receiving User Input

Sep 25, 2013

I'm trying to build an array of a certain size, after receiving user input. The method I'm trying is

int var = 3;
int* ar = new int[var];

When doing tests I did this (and it worked) and red flags popped off in my head.

int var = 3;
int* ar = new int[var];
ar[0] = 0;
ar[1] = 1;
ar[2] = 2;
ar[3] = 3;
ar[4] = 4;
cout << ar[0] << ar[1] << ar[2] << ar[3] << ar[4] << endl;

This method is considered safe, and possibly tell me why I'm not getting stack errors when trying to overload the array?

View 9 Replies View Related

C :: User Input 6 - Array To Display Even Number From 0 - 6

Apr 5, 2013

If the user puts in a 6. I need the array to display the even number from 0 - 6. Right now what it does is it displays the first six even numbers. Okay as I'm writing this I'm starting to see where my problem might be..

Code:
void sumIntegers () {
int arr[50];
int i = 0;
int num = 0;
int sum = 0;

[Code] .....

View 1 Replies View Related

C/C++ :: Display Unique Date And Its Related Price Found In Txt File

Apr 23, 2015

Currently i have a system that will store user input into a txt file, and have a function that will compute the daily sales of the month(Check by system date month) and display the sales of the day and the grand total of that month.

Take for example, the system date now check that the current month is Apr. Below are my current output:

20Apr2015 $11.5
20Apr2015 $15.5
22Apr2015 $4.5
25Apr2015 $4.5
28Apr2015 $4.5
20Apr2015 $4.5
Grand Total $45

But my desired result should be as below

20Apr2015 $31.5
22Apr2015 $4.5
25Apr2015 $4.5
28Apr2015 $4.5
Grand Total $45

Textfile data:

1|Bag|2|3|6|20Apr2015
2|Fruit|2.3|5|11.5|20Apr2015
3|Fruit|2.3|5|15.5|20Apr2015
4|Water|0.9|5|4.5|22Apr2015
5|Water|0.9|5|4.5|25Apr2015
6|Water|0.9|5|4.5|20Jul2015
7|Water|0.9|5|4.5|20Jul2015
8|Water|0.9|5|4.5|28Apr2015
9|Water|0.9|5|4.5|20Apr2015

Below are my code.

struct TransactionPile {
// to record item information.
string itemid;
string itemdesc;
float unitprice;
int quantity;
float totalprice;
string date;

[Code] ....

View 6 Replies View Related

C :: Prompt User For Input And Display Character In Every Line

Mar 17, 2013

I am having problems printing "->" on the beginning of each line, im trying to do it as a loop and ending it when the user types "q". also i would like to know how to ignore text from the user when the input begings with a specific character. heres what ive done so far, and not currrently working as expected.

Code:
#include <stdio.h>
int main (void) {
char prompt;
printf("~~~ FRACTION CALCULATOR ~~~

[Code] ....

View 1 Replies View Related

C++ :: Store User Input Then Display Array Contents?

Jan 10, 2015

I'm coding a hangman game. I'm trying to store user entries so i can output them to show the user what they have already entered. Problem is that it's not display anything at all.

I'm trying to store multiple characters of course, and then display all characters stored.

char guess[27]={0};
cin >> guess[26];
int hit=0;
for(int i=0; i<len; i++) {
if( guess[26] == hidden_word[i] ) {
hit++;
select_word[i] = guess[26];
if(strcmp(hidden_word,select_word) == 0) {

[code]....

EDIT: I also get the error - Stack around the variable 'guess' was corrupted. At the end of the game.

View 6 Replies View Related

C++ :: Read User Input - Count And Display Vowels

Sep 26, 2012

I'm trying to code a program to read the user's input and have it:

-count vowels
-stop counting vowels after '.' or '?' (ie. abcdjwef is 1 a, 1 e; while fje.fwdfeiii is just 1 e)
-closes when ENTER is pressed after a '.' or '?' is found (ie. closes after 'abacds. ENTER' as well as 'as.fefsdf ENTER')
-display the number of vowels

Is there any way to do this with only 'cin >> userInput' and a while loop checking for punctuation?

View 1 Replies View Related

C++ :: How To Change User Input To Display In Italic Font Style

May 29, 2014

How do I change User Input to display in Italic font style?

Let's say user inputs a word, then display that word in italic font.

View 3 Replies View Related

C++ :: Display All The Contents Of A File Excluding One Based On User Input

Mar 10, 2014

i want to display all the contents of a file excluding one based on user input say i have 4 records in the file numbered 1 to 4....the user chooses 2 to exclude it outputs records 1,3,4,4 when it should be records 1,3,4 what am i doing wrong here is the code.its basically displaying the last record in the file twice

void excludeRecord()
{
ifstream read;
read.open("Data.txt");
int recordC =0;
string fnameC = " ";
string lnameC = " ";

[Code]...

View 2 Replies View Related

C++ :: For Loop - Display Smallest And Largest Numbers From User Input

Jul 29, 2013

I'm suppose to write a program using (for loop) that asks the user to enter any amount of numbers, so that it can display the smallest and largest. My program successfully finds the largest, but it is always displaying 0 for the smallest, I think Im doing something wrong with the internalization but I dont know what to change it to.

This is what I have ....

#include <iostream>
using namespace std;
int main() {
int amount;
int count;
int number = 0;
int smallest = 0;
int largest = 0;
cout << "Enter total numbers to process: ";

[Code] ....

View 4 Replies View Related

C++ :: Array Searching - Display Highest And Lowest Number From User Input

Aug 26, 2013

I am having a problem printing out the results for my code, It is supposed to print out the largest and smallest value in the array, but keeps giving me a value not entered and I don't know why.

//This program lets the user enter 10 numbers and then display the highest and lowest number.

#include <iostream>
#include<stdio.h>
using namespace std;
int main() {
const int NUM_ENTERED = 9;
int number[NUM_ENTERED], highestValue = number[0], lowestValue = number[0], count=0;

[Code] .....

View 2 Replies View Related

C++ :: User Defined Program - Compute Price Per Square Inch Of Cake Using Overloading

Nov 21, 2014

Create a user-defined program that will compute the price per square inch of a cake using an “overloading”. The cake could be a circle or a square type. In the main function, ask for the price of a circle cake and its diameter, while for the square cake, ask for the price, its length and width. The process must be done inside the different function of each cake. (Note: two sub function for the computation of a circle and a rectangle)

Note that when I made this program something weird happen. After inserting the name, all things follow.

<code>
#include "stdafx.h"
#include <iostream>
using namespace std;
double areaRectangle(int l, int w);
double radiusCircle(int r);

[Cpde] .....

View 4 Replies View Related

C :: Read Amount Of Order From Standard Input / Compute And Print Total Price After Discount

Apr 13, 2014

A Bookseller makes special discount for multiple orders of a book as follows:

AMOUNT and DISCOUNT as follows.

5-9 5% 10-14 10% 15-19 15% 20+ 20%

Write a C main function to read the amount of order from the standard input and compute and print the total price of the given order after the discount. Assume that unit price of a book is 10.00$

My problem is that.When i start with this

Code:
#include<stdio.h>
#include <stdlib.h>
int main(void)
{
int number;
float TotalPrice;
printf("enter a number:");

[Code] ....

I get 0 if i enter a number between 0 and 4(0 and 4 included). I don't know where I am doing a mistake. I also want to know if i can handle this buy just if statements. or how can i do it by while and for loops ?

View 1 Replies View Related

C++ :: Program To Order Pizza - Empty Controlled Statement Found Error

Aug 25, 2013

I am creating a pizza program for ordering a pizza and I have removed all the errors except for two. I have tried everything I can think of to fix this problem so it will compile, but to no avail. The only errors left are:

1>------ Rebuild All started: Project: Pizza Order App Midterm, Configuration: Debug Win32 ------
1> stdafx.cpp
1> Pizza Order Midterm.cpp
1> Pizza Order App Midterm.cpp
1>c:usersindia-n-jerrydocumentsvisual studio 2010projectspizza order app midtermpizza order app midtermpizza order app midterm.cpp(57): warning C4390: ';' : empty controlled statement found; is this the intent?

[Code] ....

The entire code is listed below seperated into 1 header and 2 cpp files.

// OrderPizzaApp.cpp : Defines the entry point for the console application.//

#include "stdafx.h"
#include "Pizza_Order.h"
#include <iostream>
#include <string>
using namespace std;

// prototypes
Pizza_Order createPizza_Order();

[Code] .....

View 5 Replies View Related

C++ :: Display Fonts With Different Size?

Dec 23, 2013

if I can use different font sizes in output screen

View 4 Replies View Related

C++ :: Let The User Specify Array Size

Oct 12, 2014

I am not sure why I am receiving the error message:

Error C2466: cannot allocate an array of constant size 0

When I run the code:

Code:
int s;
cout<<"Enter the size:
";
cin>>s;
int array[s];
C++ masters,

View 7 Replies View Related

C :: User Defined Array Size

Jul 23, 2014

The instructions call for the user to define the size of the array and all I have ever done is use a predefined size for the array and then let the user fill it. Here is what I have so far:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void Display (void);
void random (int *, int);
void Ascending (int *, int);
void Descending (int *, int);

[code]....

View 7 Replies View Related

C++ :: User Declaring The Size Of Array?

Dec 1, 2014

is it possible to use this code ?

#include <iostream>
int main(int argc, const char * argv[]) {
int number = 0;
std::cout << "napis cifro za array
";
std::cin >> number;

[Code]...

It does work on xcode but doesn't in microsoft visual studio 2013. Where is the problem?

View 3 Replies View Related

C :: Stomp Size Of Array With What The User Inputs?

Apr 5, 2013

How can I stomp the arr size of 50 with the value the user inputs? The function doesn't sum up the even integers from 0 to the value the user inputs. Instead it sums up exactly that many even integers.

Is there a way I can stomp the size of the array with what the user inputs so that the sum calculation never goes past the value the user inputs?

Code:
void sumIntegers () {
int arr[50];
int i = 0;
int num = 0;
int sum = 0;
printf("

I want to sum up even integers <= 50.

[Code] .....

View 4 Replies View Related

C++ :: User To Enter Size Of Dynamic Array

Apr 22, 2013

I'm doing an exercise which involves for the user to enter the size of the dynamic array and then enter the numbers, but then it needs to create another dynamic array with the same numbers expect if the number repeats it only has one of it. I've done the first part of the exercise but I'm having trouble with creating the new array.

View 10 Replies View Related

C++ :: Input From Txt File Size?

Sep 7, 2014

I finally accomplished what I'd asked for earlier.

I'm able to input data from txt file to c++ array.

the Text file contains around 60,000 lines "numbers" to be loaded into a c++ array to calculate some stuff.

I'm able to load 60,000 lines "txt file size 1.1MB" no problem, but sometimes when I try to load more lines "from a file around 1.4MB", the process terminates and gives me an error message "n.exe has stopped working, Windows is checking a solution to this problem" and Code::Block shows error "Process terminated with status -1073741819 "

View 2 Replies View Related

C++ :: Using Array Of Size That Will Be Determined By User - Implementing Vector

Oct 20, 2013

I am trying to use an array of a size that will be determined by the user, therefore I must use a vector, right?

In class I was told that this is how I call a vector:

vector <int> x;

Is the vector called vector? Is it called x?

Can I do this?

for(int i=0;i<=10;i++)
{
cout<<x[i];
}

Some basic ways of implementing a vector? How it works or how I can do anything with it.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved