C++ :: Corporate Data Sales Structure

Nov 20, 2013

Corporate Data Sales

Write a program that uses a structure named CorpData to store the following information on a company division.

Division Name(North, South, East, Or West)
First quarter sales
Second quarter sales
Third quarter sales
Fourth quarter sales
Total annual sales
Average quarter sales

Include a constructor that allows the division name and four quarterly sales amounts to be specified at the time a CorpData variable is created.

The program should create four variables of this structure, each representing one of the following corporate divisions: North, South, East and West. Each variable should be passed in turn to a function that calculates and stores the total annual sales and average sales for that division.

Once this has been done for each division, each variable should be passed in turn to a function that displays the division name, total sales, and average sales.

Here is my code:

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
struct CorpData {

[Code] ....

View 1 Replies


ADVERTISEMENT

C++ :: Array Sales Bar Chart?

Dec 17, 2012

I need to make a bar chart with asterisks that looks like this:

Store 1: ******
Store 2: ***
etc.

anyway, right now what I have is:

Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
const int STORES = 5;
int sales[STORES], i;
for (i = 0; i < STORES; i++) {

[code].....

It's not displaying asterisks.

View 1 Replies View Related

C/C++ :: Build A Sales Company Class?

Jul 1, 2014

Build a class named "salesCompany". Save it's name with a string and an array with records which will be filled with values from sales in different cities of the company.

Build the constructor which must get as a parameter the name of the company and a text file which will fill the array. There is an example of the text file format. Every line saves the sold quantity of a product, identified by a code, in a certain city.

CodeCityQuantity
1a63bCity11200
45ab8City2550
#include <iostream>
#include <string.h>
using namespace std;
class salesCompany {

[code].....

what should I add more and how can make it available for the user to enter as an input a text file.

View 1 Replies View Related

C/C++ :: Quarterly Sales Program Using 2D Arrays?

Mar 6, 2014

I wrote this program using struct and it works fine, now I want to write it just using arrays and I don't think i can do it. So here is the original code:

#include <iostream>
#include <string>
#include <fstream>
#include <ctime>
#include <cstdlib>
using namespace std;
//function declarations
void init()

[code].....

View 2 Replies View Related

C# :: Displaying Multiple Images And Adding Sales To Them?

Aug 28, 2014

My application requires the user to add sales to images, this is done by displaying the image for the GUI, and then the user would add sales using that images ID which is brought in from the database.

In part this is 2 questions, first question is what is the best way to generate a List for use when adding the sales to the database. The List would need multiple strings for each sale. So for example:

Image 1 (Sale)

- JPG ID
- Product ID
- Product Quantity

So i'm going to assume i'm best creating a new instance of a custom class for each sale, and then add each instance to a List<Sale>?

public class Sale
{
public int SaleID { get; set; }
public int JpgID { get; set; }
public int SaleQty { get; set; }
}

Then I need a decent way to update this List with the GUI controls. So maybe get the JPG ID and set name of the Sale Class Instance to the ID, in this way its unique and I can update that instance when it comes to increasing the sale of a product or decreasing it.

Second part comes to the design of the GUI of adding sales, when I made this using HTML/PHP that was easier. It looked something like this:

If I wrote some code to generate that kind of design again in C# it going to require many Controls, wouldn't that be a bit intensive on the system? I just want something which looks great but also functions good.

At some point I'm going to switch to WPF, but I just need to get a working prototype working now which my client can use, and then update it when I have more time as I have got other Web Related projects that need doing, so at the moment WPF is out of the question.

View 2 Replies View Related

C :: Scope Of A Data Structure

Oct 9, 2013

how to solve this undeclared error when compiling this code. I assume it has something to do with scope.

C code - 47 lines - codepad

Code:

#include <stdio.h>
int main(void) {
struct bank_account {

[Code].....

View 3 Replies View Related

C++ :: Asymmetric Data Structure

Mar 18, 2013

I am trying to create an structure of data with following elements:

struct stest {
std::vector<int> na;
std::vector<double> nb;
std::vector<double> va;
std::vector<double> vb;
std::vector<double> vc;
std::vector<double> vd;
}

I would like to modify the composition of this struct, so that I can create a special data structure by

vector<stest*> data_test;
for(int i = 0; i < 10; i++)
data_test.push_Back(new stest);

within this structure, I have: only one na and one nb, but ten groups of combination of va, vb, vc, vd that I can access by pointer, which means na, nb are independent but still inside of the structure.

View 2 Replies View Related

C++ :: Two Dimensional Map - Data Structure

Apr 4, 2013

I'm currently having the following data structure:

typedef struct {
int a;
int b;
} S;
<vector <vector<S> > v;

Now I also have different pointers that can be set in connection with one instance of the above shown vector. Therefore I was attempting to work with a map:

map<p*, <vector<vector <S> >, vector<sI> > m;

However, it seems like it doesn't work that way. Therefore I tried the following:

map<p*, map<<vector<vector <S> >, vector<S> > > m2;

With this attempt I do now, however, get another mistake here, that [] cannot be used here:

S s;
m2[p][0].push_back(s);

View 13 Replies View Related

C++ :: What Data Structure Does A Vector Use

Dec 14, 2013

Does it use Linked List or Dynamic Array?

I want to know this because if I happen to want to use a lot of insertions and deletions then it is more efficient to make use of Linked List instead of Dynamic Array.

While, if I happen to want to just access random parts of the Array, then Dynamic would be more efficient.

I want to make a 2D game using SDL engine and I need to check whether or not an object is colliding with a list of other objects. (because there would be more then one objects on the map.)

Since I would simply be accessing each object sequentially to check whether or not the object is colliding with another the object in question, and since any of those objects could "die" and be deleted at any time, it makes more sense to use Linked List then a Dynamic Array.

View 8 Replies View Related

C/C++ :: How To Use One Structure Data In Other Structures

Jul 2, 2014

I created one structure and the created structure is using in few more structures, but i did not get the proper data.

typedef struct _MSG_HEADER{
//MESSAGE_HEADER 40 bytes
short iApiTcode;
short iApiFuncId;
int LogTime;
char AlphaChar[2];

[Code]...

My requirement is have to fill the MessageHeader structure & we can use that header in all the structures entire program.

View 3 Replies View Related

C++ :: Vectors With Structure - How To Add Data

Nov 26, 2014

I have two structs like below,

struct SP {
string sp1;
string sp2;
};
struct SL {

[Code] ....

How to add data to slVect ?

View 6 Replies View Related

C++ :: Using Custom Class For STL Set Data Structure

Oct 27, 2014

When we want to use custom classes for the STL set data structure, how to do it?

I look around and see people passing comparators, overloading operator(), and also overloading operator< in the class itself.

Which one's the idiomatic c++ way?

View 1 Replies View Related

C :: How To Store Data Structure Into 2D Array

Mar 22, 2013

I have this data store into a data structure.

i j x y w h w*h
0 0 0 0 9 11 99
1 0 0 11 9 10 90
2 0 0 21 9 11 99
0 1 9 0 8 12 96
1 1 9 12 8 7 56
2 1 9 19 8 6 48

[Code]...

Code:

struct data {
//Here
/*! horizontal position */
int x;
/*! vertical position */
int y;
/*! width */
int w;
/

[Code]...

data and then i have an array /*! it contain group_id of each data line*/ int group_id[16]={0,0,0,0,3,3,1,1,1,3,3,2,2,2,2,1}; I never worked with 2D array before. My problem is that i want to create a 2D array of that data for example if i write data[j][i].. It will give me the reference/value of all data lines that belongs to j column, and same with group_id[j][i]. I don't know how i can store these structure vaules in this like 2D array.

View 2 Replies View Related

C++ :: Data Structure - To Check If A Set B Is A Subset Of A Or Not

Feb 9, 2013

To check if a set B is a subset of A or not. Which data structure to be used to store set A for quicker response(linked list/hash map)? What if I want to check intersection also?

View 1 Replies View Related

C++ :: Implementing Stack Data Structure As ADT

Mar 7, 2014

So I've been working on implementing a stack data structure as an ADT, the program compiles, but when I try and push elements on top of the stack, for some reason the stack is full.

#ifndef H_stackADT
#define H_stackADT
template <class Type>
class stackADT {
public:
virtual void initializeStack() = 0;
virtual bool isEmptyStack() const = 0;

[Code]...

View 4 Replies View Related

C++ :: Data Structure - Program Using Stacks

Nov 3, 2013

Given a set of different types of paired symbols; determine whether it is balanced or not (the opening and closing version of each type are paired correctly). Any other type of characters may appear in the input will be neglected.

For example:
(**(*[*])****) is balanced, also [{}**[]**()]** is balanced. But ((*{*)*}) is unbalanced as well as [()***[]***{*(*)}.

Write a C++ program that requires a string containing and expression as an input from the user and check for balanced bracket pairs using stack data structure.

Here is my code which give me nothing when I run it.

#include <iostream>
#include <string>
using namespace std;
class CustomStack {

[Code] ....

View 1 Replies View Related

C++ :: Data Structure In Sudoku Game

May 23, 2014

I want to know if you have made Sudoku game in c++, which kind of data structure did you use? shortly, which part of the game did you use for? [Array, Stack, Queue, Linked List, Binary Search Tree]

View 5 Replies View Related

C++ :: Complete Graph Data Structure

Apr 13, 2013

I need building a complete graph from a file. The format in the file is as follows.

[ vertex 1] [ x_coordinate 1] [ y_coordinate 1] [cityname 1]
[ vertex 2] [ x_coordinate 2] [ y_coordinate 2] [cityname 2]
. . .
[ vertex n] [ x_coordinate n] [ y_coordinate n] [cityname n]

What kind of data structure shall I use in order to store date in a complete graph so there is an edge between every pair?

View 7 Replies View Related

Visual C++ :: Program To Calculate Sales Totals For A General Store - While Loops

Jan 25, 2013

I need coding this project using while loops and cout/cin.. It is suppose to be one while loop for the whole thing and inside of the first while loop is the second while loop for each sale separately.

You have been asked to write a program to calculate sales totals for a general store. Your program will not know how many products each customer will buy, so your program will have to repeat the process until the last product has been entered (use -1 for Product ID to end each sale). After each sale your program must ask if you want to do another sale (Y - continue, N - end program).

At the beginning of the day, the cash drawer has $500 in it. At the end of the program you must display how much money is in the drawer after handling all your sales transactions.

Input
Your program must take the following input:
- Product ID Number (int)
- Quantity for each item purchased (int)
- Cash Received at the end of the sale

Use the following dataset to determine the price and taxability for each item.

First Sale:
Product ID Price Quantity Taxable
101 $65.00 2 Yes
102 $12.50 1 No
103 $24.50 5 No
104 $38.75 4 Yes
105 $17.80 6 Yes
106 $16.50 2 No
107 $42.85 8 Yes
108 $32.99 2 Yes
109 $28.75 1 Yes
110 $51.55 1 No

Second Sale:
Product ID Price Quantity Taxable
102 $12.50 1 No
103 $24.50 1 No
106 $16.50 1 No
107 $42.85 1 Yes
108 $32.99 1 Yes
109 $28.75 1 Yes

Third Sale:
Product ID Price Quantity Taxable
106 $16.50 4 No
107 $42.85 3 Yes
108 $32.99 1 Yes
109 $28.75 5 Yes
110 $51.55 2 No

Calculating Tax
For those items that are taxable, assume a 7.5% sales tax. Be sure to keep a running total of tax for the each sale.

Getting Started
You must use the starter file provided with this assignment.
What to turn in:
- A copy of your source code
- A printout of your program's output

View 2 Replies View Related

C :: Data Handling And Structure For Embedded UAV Project

Apr 16, 2014

Data handling for a UAV project I am trying. My background is in Microcontrollers but I have never had exposure to "sound" programming practice...

I have got 2 microcontrollers to drive a UAV craft I've made. One "firmware" micro collects all the sensor data and then passes it to the other "application" micro for control processing. Once decisions have been made this is sent back to the "firmware" micro so that actions are taken.

So in essence I am sharing a raw data chunk periodically between the 2 processors that has outputs and feedback data. For the moment this is captured as one big buffer array on either micro after receiving. For easier structure I thought of bouncing this buffer that contains all sensor information and control variables between the 2 processors (visualize a ping pong game with all the possible variables from both micros - bandwidth between the micros is not a limitation) There are quite a few modules that want to access information from this buffer and write control actions back to it.

I was thinking of constructing a struct on both micros to access this "raw data" from the buffer and set it up with variable names so that it is easier for functions to read info and write controls back.

But this would mean that the data is accessible to every function, and there is the fear that some functions will write to the input data or write to control variables that they should not have access to. I also need to reduce memory copies and the like due to limited memory on each micro.

View 4 Replies View Related

C :: Predictive Text Program - Data Structure

Jan 19, 2014

Been given an assignment to create a predictive text program. What data structure I should use for this and the steps I should take when I make the program?

View 12 Replies View Related

C :: Compact Table Representation - Data Structure

Jul 19, 2013

Data structure problem. I have a table of the following format:

Code:
C/R 1 2 3 4 5 6 7 ...
1 x x x
2 x
3 x
4 x
5 x x x
6
... s

So my column and row names are integer numbers if an outcome of some game for a certain column and row lable is a match then we have an x on that position. The size of the integer names for both column and row name is quite large (let us imagine that it is so large that you would need a machine with 500GB of RAM memory to hold this type of table even if x's are treated as regular char's) . In every row there is at least one x and for every column the same holds for the columns. However, the number of x's for a row or a column can be bigger then 1. How to store this table efficiently? (using as less memory as possible).

The data structure should be efficiently accessed in the column fashion that is, if i want to get all values for column 4 I should be able to do that in O(N) time where N= the number of rows.

View 10 Replies View Related

C++ :: Create Structure To Hold Data For A Kennel

Apr 3, 2013

// This program creates a structure to hold data for a kennel

#include<iostream.h>
struct KennelList {
int dogID;
char gender;
int age;

[Code] ....

View 2 Replies View Related

C/C++ :: How To Create Objects Of Same Data Structure (type)

Dec 31, 2014

well i create a State.h class

#ifndef STATE.H
#define STATE_H
class State {
public:
virtual void handle_action() = 0;
virtual void update() = 0;
virtual void render() = 0;
};
#endif //STATE.H

What i'm trying to create is a simple State Manager for SFML! I created another class that inherits State.

#pragma once
#include "state.h"
class FirstState : public State {
public:
FirstState();
~FirstState();
void handle_action();
void update();
void render();
};

So the question is this, each state that i have will inherit the State class. However, i wanted to perhaps add each state object into a vector array. But i'm not sure as to what data type it be? I have a state manager class that will contain the vector.

What i want to do is this, each game state will create an object that will inherit functions from the state.h class. I want to store them all in a vector array, but each object is clearly named different. My curiosity was wondering, since all those different states inherit the State.h class, can i simply create a State Object std::vector<State> *states; that will contain all those different state objects?

[URL]....

View 1 Replies View Related

C++ :: How To Create Tree Data Structure With Boost

Oct 1, 2013

There seems to be lacking support for tree data structure. You have to implement it yourself?

View 2 Replies View Related

Visual C++ :: Print Sequence Data Structure

Sep 15, 2012

Printing out a sequence data structure. I am using a PC running Windows 7 with Microsoft Visual Studio 2008. This sequence has a dynamic array which stores a value_type which can be any of the built in data types for C++. Initially the sequence is 30 slots long. When the program starts the user starts at the beginning of the sequence by choosing the "!" option from the menu. The user will then insert a number such as 11 by selecting the "I" option (upper or lower case). Then the user will go to the next position in the sequence by selecting the "+" option then insert 22, then go to the next position and insert 33.

To show that the numbers are actually in the sequence the user goes back to the beginning of the array by selecting "!" and then select "C" to display the current number of 11. Then the user goes to the next position by selecting "+" and then "C" to display 22 and so forth. At this point the member function called current() works just find , but when trying to print the contents of the entire sequence the program displays garbage. Why?

Code:
// FILE: sequence_test.cpp
// An interactive test program for the new sequence class
#include <cctype> // Provides toupper
#include <iostream> // Provides cout and cin
#include <cstdlib> // Provides EXIT_SUCCESS
#include "sequence2.h" // With value_type defined as double
using namespace std;
using namespace CISP430_A2;

[Code].....

View 2 Replies View Related







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