C/C++ :: Create Billing System Without Using Pointers - Array Calculations

Feb 17, 2014

I am trying to create an billing system "without using pointers". This is my class assignment. In this,

1) User inputs the name
2) The system asks how many items he has purchased
3) Displays a bill number [just a random number]
4) System asks for the item names the user purchased and stores them in an array (of max 10 (ten) inputs (or items))
5) After each item the user inputs, the system asks for the price of the item (stored in an array of numbers)
6) The total bill is calculated, by adding the sum of all prices in the array

I am having terrible difficulties in coding #4 and #5. Somehow, they aren't going well together. Here's what I have:

#include<stdio.h>
#include <stdlib.h>
int main() {
char item[10][10], answer = 'y', name;
int price[10], total_item, total_price = 0, i, j, a, total_bill = 0, max_items = 10, max_char = 10;

[Code] ....

You might find a lot of unused variables

View 10 Replies


ADVERTISEMENT

C++ :: Program For Billing System - Regular Package Function

Jan 5, 2015

I have programmed a program for billing system. I have used parameters and arrays. All the functions are working except a one function. (Regular package function).

#include <iostream>
#include <fstream>
#include <string>
#include <ctime>
using namespace std;
void main(int &minutes, int &minutesd,int &minutesn) {

[Code] .....

View 3 Replies View Related

C :: Create Array Of Pointers To Pointers Which Will Point To Array Of Pointers

Feb 28, 2014

I'm trying to create an array of pointers to pointers which will point to array of pointers (to strings) I tried

Code:

int i;
char *string[]={
"my name is dave",
"we like to dance together",
"sunny day",
"hello",

[code]...

the app keeps crashing , I don't know how to make the array-elements to point to another array-elements..

View 4 Replies View Related

C++ :: Create Program That Displays Median Of Array Using Pointers

Feb 27, 2013

The assignment is to create a program that displays the median of an array using pointers. Assume the array is already in ascending or descending order.I'm getting errors currently on the bottom two "return median;" statements.The code that I have so far is as follows...

#include <iostream>
using namespace std;
char again;
int getMedian(int*, int);
const int constant = 100;

[code]....

View 3 Replies View Related

C++ :: How To Find Architecture Of System Using Pointers

Jun 4, 2012

I have a program (below)

int main() {
int x = 1;
char *y = (char *) &x;
printf("%d
", *y);
}

The output will be either "0" or "1" depending on the architecture of the system.When I executed on my system I got output as "1", now what is the architecture of my system is it 32 bit or 64 bit?

View 8 Replies View Related

C/C++ :: Using Values From Distance Array In Function To Be Used For Calculations

Mar 30, 2014

I know that the issue is around the array distance being of type double in the function get distance of type double. My question is how do i get around using the values from the distance array in the function to be used for calculations.

#include <stdio.h>/* initialization of preprocessor directives*/
#include <stdlib.h>
#include <math.h> /*preprocessor directive in order to use sqrt function*/
int calcSecondsvar(int,int,int ,double);
double getdistance(double,double,int,int,int);

[Code] ....

I forgot to mention that it keeps giving me the error cannot convert from 'double[8] to 'double' ....

View 2 Replies View Related

C++ :: Create Grading System Using Multimap

Jun 20, 2014

I have an assignment to create a grading system using multimap. It's not completed yet at the moment but whenever i try to compile it tells me "no match for 'operator[]' in lines 56,57,etc. I

#include <iostream>
#include <string>
#include <map>
using namespace std;
class Student {
public:
//--- Constructor
Student (int id = 0, double gpa = 0);

[Code]...

View 3 Replies View Related

C/C++ :: How To Create Payroll System Using Arrays

Feb 21, 2015

Create a payroll program to store and calculate the payroll for a small company with a maximum of 20 employees.

Program parameters are as follows:

1. Create a menu with the following options (use a do-while loop):
A or a to add employee info
D or d to display employee info
T or t to display total payroll
S or s to display the info of all employees
Z or z to exit program

The information for each employee is: employee number, hours worked, pay rate per hour, tax deduction.

2. Use an array of doubles to store employee information.

3. Menu option A or a: ask the user for the employee information one value at . a time and store it in the array.

Please enter employee number: 2190
Please enter hours worked: 32.50
Please enter pay rate: 9.25
Please enter tax rate deduction: 5.50

4. Option D or d: ask the user for an employee number as integer and display . the information for the corresponding employee (cast the employee number

. in the array to integer and then compare). If employee number does not . match, output a msg. indicating "no such employee". If the employee number . is a match, output all the employee information stored in addition to the . calculated deduction and salary.

Output sample:
Info for employee number: 2190
Hours worked: 32.50
Pay rate: $ 9.25
Tax deduction: 5.50 %
Total pay: $ 284.89

5. Option T or t: calculate and output the sum of the total pay of all
. employees.

6. Option S or s: display the information for all employees in the same
. format as in option B.

7. Option Z or z: exit the program.

#include <stdio.h>
#define MAX [20]
int main(void) {
int i;
for (i=0;i<=20;i++) {
char MenuOption=0;
int EmployeeNumber;

[Code] .....

View 1 Replies View Related

C++ :: Create Inventory System Using Classes And Objects?

Jan 13, 2015

I'm trying to create an inventory system in C++ using classes and objects. Here is what I have now

Item.h

#pragma once
#include <iostream>
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>

[Code]....

Basically what I want my inventory system to become is this: [URL] Each slot can hold an item.

Basically this inventory system should be able to do what RS Inventory system can do. (Hold items, Use items, Equip Items (No need for moving item))

View 5 Replies View Related

C++ :: Billing Program For A Bakery

Jul 25, 2014

So, the point of this program is to make simple billing program for a bakery. The program starts by having the cashier enter in the prices for single muffin, a half-dozen, and a dozen muffins. Then, the cashier enters in the amount that the customer wants. Based on the amount entered, the program will return the best offer. (For example, if the customer wants 11 muffins, but the price of 11 individual muffins is greater than the price of a dozen muffins, the program will recommend the customer by a dozen muffins). I'm having trouble getting my program to do the calculations correctly. I think my algorithm is correct, but it's not displaying properly.

#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
class Bakery {

[Code] ....

View 7 Replies View Related

C++ :: Program To Compute And Print A Billing Statement For Each Patient

Oct 17, 2013

Community Hospital needs a program to compute and print a billing statement for each patient. Charges for each day are as follows:

a. room charges: private (P) room = $125.00; semi-private (S) room = $95.00; or ward (W) = $75.00
b. telephone charge = $1.75
c. television charge = $3.50

Write a program to get data from the keyboard, compute the patient’s bill, and print an appropriate statement. Typical input (nut yours do not have to be identical to this) is the following:

How many days was the room occupied? 5
What type of room? P
Telephone used during the stay? N
Television used during the stay? Y

Keep in mind that the user needs to know that the input can be any integer number of days for the length of stay, either (P, S, or W) for the room type, and either (Y or N) for both telephone and television options.

A statement (which yours MUST be identical to) for the data given follows:

Community Hospital Patient Billing Statement

Number of days in hospital: 5
Type of room: Private
Room charge:$ 625.00
Telephone charge:$ 0.00
Television charge:$ 17.50

TOTAL DUE = $642.50

View 3 Replies View Related

C :: Create Function To Create A Dynamic Array That Fill With Randomly Generated Integers From 0 To 50

Oct 26, 2013

I have a struct called Array and I'm to create a function to create a dynamic array that's fill with randomly generated integers from 0 to 50 (inclusive) and a function to destroy the array for freeing its memory. Below the code that I have written so far.

Code:

* Struct */
typedef struct {int *pArray; //the dynamic array
int length; //the size of the dynamic array}Array;
/* Function to create a dynamic array */
Array *initializeArray (int length) {int i;
}

[code]....

View 7 Replies View Related

C++ :: GPA Evaluation System Through Array

Jun 2, 2013

Computerized GPA Evaluation System using Array

You are required develop a computerized GPA evaluation system of your class using array. The basic idea is to calculate the GPA (Grade Point Average) of each subject and then calculate the GPA of whole semester of all the students of the class and on the basis of that GPA calculate the grade and remarks of each student of the class. Suppose that the total students of the class are 50. Your system must also provide the facility of the following:

1.Searching a student result according to his/her roll number.
2.Updating the obtained marks of the students in case of any mistake in entering marks.
3.Display the result of student who is the topper of the class
4.Display the result of the student who got minimum CGPA out of the class.
5.Display how many number of students got greater than or equal to 3.0 CGPA.
6.Display how many number of students got greater than or equal to 2.00CGPA and less than 3.00.
7.Display the total number of students who got A grade in the semester.
8.Display the total number of students who got B grade in the semester.
9.Display the total number of students who got C grade in the semester.
10.Display the total number of students who got F grade in the semester.

Detailed Description:
You are required to take the student’s marks for four subjects (Programming fundamentals, Calculus, English and Computing) as input from the user at runtime. After that calculate the GPA of each subject and the whole semester. Assume that total marks of a subject are 100 and each subject is of 3 credit hours except programming fundamentals. Programming fundamentals subject has 4 credit hours.

Complete Assessment system is given below in the table:

S.#Percentage (%)GradeGPARemarks
185-100A4Excellent
280-84A-3.75Very Good
375-79B+3.50Good
470-74B3.0Satisfactory
565-69C+2.50Above Average
660-64C2.0Average
755-59D+1.50Pass
850-54D1.0Just Pass
9Below 50F0Fail

Table: Assessment Scheme
•Percentage of a subject = (obtained marks / total marks) * 100. Percentage works to find the grade of the student.
•GPA of whole semester = multiply GPA of each subject according to the percentage of obtained marks by the number of credit hours for that course, sum up the GPA of all the subjects, and then divide this sum by the total number of credit hours taken in semester.

For example suppose the GPA in subject X is 2.5, in subject Y 2.6, and in subject Z is 3. Assuming that each subject is of 3 credit hours then GPA of whole semester will be calculated as:
GPA= (3 * (2.5 + 2.6 + 3)) / 9
GPA= 2.7

On the basis of Semester GPA, you have to give grade and remarks to the student. You have to study the above table for other types of remarks according to grade.

•If a student has less than 50 marks in a subject, a message should display that “you have to repeat this subject “.

Code:

#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
main() {

char a,b,c,d;

[Code] .....

View 6 Replies View Related

C/C++ :: Calculations From Textfile?

Mar 31, 2014

I have a text file that contains values as follows:
2013 05 27 15 52 02.049824 231.401 0.022 49.738
2013 05 27 15 52 02.668822 229.814 0.019 49.738
2013 05 27 15 52 03.283705 228.528 2.599 49.726
2013 05 27 15 52 03.898469 230.140 2.576 49.751

Column1=date, Column2=Month, Column3=Day, Column4=Hour, Column5=Minute, Column6=Seconds, Column7=Voltage(Vrms), Column8=Current(Irms), Column9=Frequency(Hz).

I have to develop a program that will analyse these time-sampled voltage and current measurements over 24 hours and find the total energy used, mean and peak power consumption and Energy used over each hour of the 24 hour period.

How do I go about doing this? I also have to use at least one integration method. The file data contains over 50 thousand lines in the format mentioned above.

View 11 Replies View Related

C++ :: Allocating Array Of Pointers To Dynamically Allocated Array?

Jan 18, 2014

I'm trying extremely hard to understand pointers and I have the basic concept down.. I feel as though my knowledge of dynamically allocated pointers and pointers in general is not enough to understand the logic behind what I'm trying to do. The problem is that the donations array must be able to accept any number of donations. I've made it do just that, but there is also an array of pointers which must each point to the same element in the donations array. The program works if I assign int *arrPtr[100] for example, but it does not work if I try to dynamically allocate it to accept the same number of elements for donations entered by the user. Here it's the snippet

#include <iostream>
using namespace std;
//Function Prototypes

[Code]....

View 2 Replies View Related

C++ :: Calculations From Text Files?

Mar 31, 2014

I have a text file that contains values as follows:

2013 05 27 15 52 02.049824 231.401 0.022 49.738 2013 05 27 15 52 02.668822 229.814 0.019 49.738 2013 05 27 15 52 03.283705 228.528 2.599 49.726 2013 05 27 15 52 03.898469 230.140 2.576 49.751
Column1=date, Column2=Month, Column3=Day, Column4=Hour, Column5=Minute, Column6=Seconds, Column7=Voltage(Vrms), Column8=Current(Irms), Column9=Frequency(Hz).

I have to develop a program that will analyse these time-sampled voltage and current measurements over 24 hours and find the total energy used, mean and peak power consumption and Energy used over each hour of the 24 hour period.

How do I go about doing this? I also need to include at least one numerical integration technique. The file data contains over 50 thousand lines in the format mentioned above.

View 2 Replies View Related

C++ :: Calculations Are Done Correctly But Showing Zero

Nov 26, 2013

#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
const int SZ = 55;

[Code] ....

View 1 Replies View Related

C++ :: Calculations From Text File?

Mar 31, 2014

I have a text file that contains values as follows:

2013 05 27 15 52 02.049824 231.401 0.022 49.738
2013 05 27 15 52 02.668822 229.814 0.019 49.738
2013 05 27 15 52 03.283705 228.528 2.599 49.726
2013 05 27 15 52 03.898469 230.140 2.576 49.751

Column1=date, Column2=Month, Column3=Day, Column4=Hour, Column5=Minute, Column6=Seconds, Column7=Voltage(Vrms), Column8=Current(Irms), Column9=Frequency(Hz).

I have to develop a program that will analyse these time-sampled voltage and current measurements over 24 hours and find the total energy used, mean and peak power consumption and Energy used over each hour of the 24 hour period.

How do I go about doing this? The file data contains over 50 thousand lines in the format mentioned above.

View 5 Replies View Related

C/C++ :: Adding Calculations To BMI Calculator

Oct 8, 2014

I have to enhance my BMI program to tell whether the person is at optimal weight, under weight, or overweight and I cannot find the correct calculation. Here is the code I have so far that works for calculating the BMI.

namespace Body_Mass_Index {
public partial class BMI_HW : Form {
public BMI_HW() {
InitializeComponent();

[Code] ....

View 14 Replies View Related

C/C++ :: Overtime And Payroll Calculations

Apr 11, 2014

When you execute my code you'll notice the regular pay for the first example will calculate to $500 when it is only supposed to calculate to $400. I'm also having a problem adding up the totals of the regular pay and overtime pay to get a total payroll which is displayed in one cout statement. 95% of my code is correct, I'm just having these two issues. To make it more clear hear is my assignment:

The regular working hour for an employee is 40 hours a week. Sometimes employees work over time. When the employee works 40 or less hours, the regular pay is calculated as number of hours worked times the hourly rate. When the employee works over time i.e. beyond 40 hours then the employee's pay has two components a) regular pay (40 hours X hourly rate), and 2) overtime pay (the overtime hours beyond 40 X time and half of the hourly rate).

void compute(incomeInfo *ptrI, int count) {                                                
    for (int i = 0; i<count; i++)  
    if (ptrI->hours <= 40) {
        ptrI->regPay = ptrI->hours * ptrI->hRate;
        ptrI++;

[Code] ....

View 1 Replies View Related

C++ :: Timer With Non-return Calculations

Dec 25, 2013

My game runs in a while loop, as you can see in the code below. I need a timer, which won't stop this loop or freeze it, but it will wait, until timer is over and executes code without interfering with the while or for loop.

Code:

Code:
#include <iostream>
#include <iomanip>
#include <windows.h>
#include <ctime>
using namespace std;
char *map[25][25];

[Code] ....

View 1 Replies View Related

C/C++ :: Menu Driven Complex Calculations

Mar 18, 2015

//complxCalc.cpp//

#include "complx.h"
using namespace std;
ifstream infile ("in.dat");
int main() {
int i = 0;
complx tempComplx;
double d = 4.5;

[Code] ....

//in.dat//
(4,4) (6,7) (2.5, 9.3) (3,8.4) (13, 26.5) (2.2, 3.4)

My plan is to make this a menu driven program, I have already got the program to give the answers but now I want it to give the user choices as well. The first step in this project is to add a menu to the program. The first menu the user sees should ask the user if the program will be taking input from a file or from the user directly via the keyboard. Regardless of option chosen, the user should then be prompted to specify whether a multiplication,subtraction or addition operation should be performed.

If the user originally chose the file input method then the program should proceed to display to the screen the results of those operations on each pair of data elements in the file and terminate. If the user chose to input via the keyboard then the user should be prompted to input the two numbers, perform the operation on those two numbers and display the results to the screen and ask the user which mathematical operation they would like to do next and continue in this manner until the user chooses to exit the program via a menu option. Fortunately the only file that needs to be edited are in.dat and complxcalc.cpp files.

View 1 Replies View Related

C/C++ :: How To Initialize Array Of Pointers To Array Of Characters

May 21, 2014

I am trying to initialize an array of pointers to an array of characters, I can do it in 3 lines but I really want to do it in one line at the same time keeping the #define.

3 lines initialization (can compile)
======================
#define A 1
#define B 2
char row1[] = {A|B, B, A};
char row2[] = {B, A};
char *test[]= {row1, row2};

1 line initialization (failed)
===============================
char *test[] = { {A|B, B, A}, {B, A} }; // <- how do i do this??

I do not want this because it waste ROM space
=============================================
char test[][3] = { {A|B, B, A}, {B, A} };

View 18 Replies View Related

C++ :: Writing Calculations For Unknown Amount Of Students?

Jun 27, 2014

I need to create a program that continuously records data until the user enters '0'

The data that I read in is the student's last name, the year of the student (1-4), the major, the gpa, and the advisors name. I then need to print out how many students are in each year (1-4), the number of students each advisor has, the average gpa for each major, and so on. This is what I have, but I am stuck and think that I might be headed the wrong direction because the only thing working is the loop (not my gpa test calc).

//This program displays information pertaining to students
#include <iostream>
#include <string>
using namespace std;
int main () {
int studYear;
double average, studGpa;
string studName, studMajor, studAdvisor, complete;

[code]....

View 2 Replies View Related

C/C++ :: Employee Payroll Calculations Program For A Class

Sep 30, 2013

getting output from my code when I compile, the codeblocks ide doesnt show any errors it just doesn't give me any out put when I compile?

Here is my code:

#include <iostream>
#include <string>
#include <iomanip>  
using namespace std;  
//
//CLASS DECLARATION SECTION

[code].....

View 1 Replies View Related

C :: Cache Optimizations / Make Multiplication And Calculations Faster?

Jan 30, 2014

I have a 125X125 array, each element is 55 bits. The cache line for the CPU ( Cortex A9) is 32 bits. Is there anyway to do optimizations, like loop tiling that would make multiplication and calculations faster?

View 5 Replies View Related







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