C++ :: Program To Simulate Customers Lining Up To Buy Tickets For Some Event

Oct 17, 2013

Create a line class using a linked list that acts as a queue (first in, first out) both enqueue and dequeue. Complete the line class so that customers can be added or removed from the line. Implement the line as a linked list of customer objects that you have developed yourself or use the vector class.

View 2 Replies


ADVERTISEMENT

C++ :: Program That Keeps Track Of Social Security Numbers Of Customers

Jun 27, 2013

I am trying to write a program that keeps track of social security numbers of customers I have to assume that its a four-digit number. When the program runs,it has to prompt that the user should enter a 4-digit number to record, or 0 to exit.

The program also needs to be able to give an error message if a certain number is entered more than once.

After all the numbers have been saved and you finally end it by pressing 0, it needs to be able to output all the entered SSN's.

Here is my code so far:

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
bool isExist(int ssn, int records[], int numberOfRecords);

[Code] ......

View 3 Replies View Related

C++ :: Program To Keep Track Of Social Security Numbers Of Customers Of A Bank

Oct 4, 2014

In this assignment, you are going to write a program that keeps track of the social security numbers (SSN) of customers of a bank. Please notice that we are going to assume that SSN is a four-digit number (e.g., 1234. 0123 is not allowed.). When the program runs, it prompts that the user should enter a 4-digit SSN number to record, or 0 (zero) to exit.

So far I have this:

#include <iostream>
using namespace std;
bool isExist(int ssn, int records[], int numberOfRecords);
int main(){
int ssn = 0;
int records[32];

[Code] .....

View 16 Replies View Related

C++ :: Program To Simulate Coin Toss

Nov 14, 2013

Write a program that simulates coin tossing. For each toss of the coin, the program should print Heads or Tails. Let the program toss the coin 100 times and count the number of times each side of the coin appears. Print the results. The program should call a separate function flip that takes no arguments and returns 0 for tails and 1 for heads. [Note: If the program realistically simulates the coin tossing, then each side of the coin should appear approximately half the time.]

View 7 Replies View Related

C++ :: Calculate Number Of Tickets And Apply Discount

Sep 8, 2013

I am trying to do a simple calculation. I just started C++ and learning about decisions. My program should calculate number of tickets and apply discount based on the number of tickets purchased. It will only execute one of the decisions.

#include <iostream>
using namespace std;
int main() {
double qty; // qty of tickets
double discount; // % of discount.

[Code] ....

View 7 Replies View Related

C++ :: Pointer Arrays - Program To Simulate Squares Most Landed On

Jun 8, 2014

I have not been using pointers that long i most of my stuff has not needed them but now they do i need to learn how to use them more. I'm writing a program that simulates the squares most landed on(for fun) and i cant get a method to work because of an array pointer.

The error is no matching function for call to 'GameLoop::Loop(int, int (*)[4])'

Here is the latest version of the code. I've been editing a lot of things so there might be some stupid errors but I've tring everything.

rolling.h and rolling.cpp are just some dice function they are working perfect.

main.cpp

#include <iostream>
#include "Rolling.h"
#include "GameLoop.h"
Rolling Roll;
GameLoop Game;

[Code] ....

View 2 Replies View Related

C++ :: Write A Program To Simulate Deck Of 52 Playing Cards

Oct 22, 2014

Write a program to simulate a deck of 52 playing cards.

Represent your deck as a 2D Array where the value in the cell is the position of the card in the deck. Represent the names for the suits and faces as an array of Strings.

Write an algorithm to shuffle the deck.

Display the deck. For Example:

1 Jack of Spades
2 Deuce of Diamonds
3 Three of Diamonds
4 King of Spades
5 Eight of Clubs
6 King of Diamonds
7 Six of Clubs
8 Six of Spades
9 Eight of Hearts

Deal two hands of five cards each. For Example:

****** HAND 1 ******
Jack of Spades
Three of Diamonds
Eight of Clubs
Six of Clubs
Eight of Hearts
...

Below is what I have so far. Dealing two hands and displaying it. How would I be able to do that?

#include <iostream>
#include <ctime>
#include <string>
using namespace std;
void shuffle(int[][2]);
int main()
{
int j,deck[52][2];

[Code]...

View 2 Replies View Related

C++ :: Program And Simulate 2 Floor Lift Control System?

Apr 28, 2014

I need to program and simulate a 2 floor lift control system. How to do that ? I need to design its program only.

View 1 Replies View Related

C++ :: Write A Program To Simulate Deck Of 52 Playing Cards

Oct 26, 2014

Write a program to simulate a deck of 52 playing cards.

Represent your deck as a 2D Array where the value in the cell is the position of the card in the deck.

Represent the names for the suits and faces as an array of Strings.

#include "stdafx.h"
#include <iostream>
#include <string>

[Code].....

The problem: I am trying to connect the 1d arrays to the 2d arrays. Right now when I write: cout << deck[3][5] << endl; The output answer is 45. How do I populate the 2d array with the 1d arrays so that when I cout deck[3][5] I get it to say "Six of Spades"?

View 8 Replies View Related

C++ :: Program That Simulate Card Game - Array Manipulation

Apr 26, 2013

Consider a program that simulates a card game, with multiple player hands and a deck to draw from. Each hand can use an array to represent the cards it contains; sometimes it is useful to also declare an additional variable for each hand (or deck) indicating exactly how many cards are present.

1) Describe a simple function that would manipulate both the array representing a hand and the number indicating the size of the hand.

2) Describe a simple function that might be able to manipulate the array without referring to the hand size variable at all.

3) Generally, if the array was passed as a parameter to a function, how often would the hand size be included as a parameter?

View 2 Replies View Related

C :: Program To Simulate Taxi Rank Implemented As Queue Via Array - Linked List

Mar 26, 2013

I have an assignment where i am required to code up in C, a program to simulate a taxi rank that is implemented as a queue via an array that can hold up to a maximum of six taxis.When a taxi arrives, it joins the rear of the queue. When a taxi departs, the first taxi in the rank is used and its departure is logged.A "rolling menu" comprising integer codes as specified below is used until 0 is entered to exit the simulation. I've done this stage but now the next stage is asking me to implement the queue as a linked list. what the difference is between an array and a linked list and what is a linked list?

View 2 Replies View Related

C/C++ :: Dividing 100 Customers Into Three Clusters

Apr 4, 2015

I wrote the following code to divide 100 customers into three clusters but it kept on hanging during execution. I used while loop. Attached is the text file to use. and the code below :

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <cstdlib>
#include <ctime>
#include <stdio.h>
#include <math.h>

[Code] ....

Attached File(s)
c201.txt (7.13K)

View 1 Replies View Related

C++ :: Customers Plan - Output Name And Two Digit Number Next To It?

Nov 8, 2013

//using bloodshed dev c++ compiler
//How can I output the name and a two digit number next to it
//example would be Indiana Jones 20
#include<iostream>
#include<string>
using namespace std;
class Customer {

[Code] .....

View 3 Replies View Related

Visual C++ :: Keep Track Of Social Security Numbers (SSN) Of Customers Of Bank

Jun 26, 2013

I am trying to write a program that keeps track of social security numbers (SSN) of customers of a bank. I have to assume that SSN is a four-digit number (e.g., 1234. 0123 is not allowed.). When the program runs,it has to prompt that the user should enter a 4-digit SSN number to record, or 0 (zero) to exit.

The program also needs to be able to give an error message if a certain number is entered more than once.

After all the numbers have been saved and you finally end it by pressing 0, it needs to be able to output all the entered SSN's.

Here is my code so far :

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
bool isExist(int ssn, int records[], int numberOfRecords);
void listRecords(int records[], int numberOfRecords);
int main()

[Code]...

View 2 Replies View Related

C++ :: Tourist Agency - Calculate Total Price For Customers For A Package Of Vacation?

Apr 25, 2013

SYNOPSIS : KBJ tourist agency Sdn. Bhd wants you to write an application program to calculate the total price for their customers for a package of vacation. The following table shows the price for three destinations (transportation and accommodation) offered by the agency:

Destination TransportationAccommodation
Pulau Redang Child RM15.00
Adult RM30.00RM95 per day
Pulau Perhentian Child RM20.00
Adult RM30.00 RM100 per day
Pulau Kapas Child RM10.00
Adult RM20.00 RM120 per day

This agency company will give some discount to a group of customers with is:

a.10% discount will be given for the group that has a least 5 adults.

b.25% discount will be given for the group that has more than 5 persons (adults and children)

c.30% discount will be given for the group that has at least 15 persons.

Your application program has to display the output using this following screen layout:

KBJ TOURIST CUSTOMER INFORMATION

Customer’s name: XXXXXXXXXXXXX
Number of Children:XXXXX
Number of Adult: XXXXX
Transportation: RMXXX.XX
Accommodation: RMXXX.XX
Total price: RMXXXX.XX

This is the code i got so far but it doesn't work..:(

#include <iostream.h>
int main () {
char customerName,code,A,B,C;
int childNum,adultNum;
double rate,discount,totalPrice,a,c;

[Code] .....

View 8 Replies View Related

C++ :: Shop Database - Take Customers ID And Scan Through A Text File Then Print Out Info

Apr 10, 2013

I have to create a small data base for a shop. One of the functions i am creating is taking a customers ID and scanning that through a text file and to print out the info about that customer. What i am having trouble with is where do i insert the string compare in my program?

//declaring array for input of customer ID
int customer_ID [20];
printf("Please enter the customer ID:");
gets( customer_ID ); //users input stored in the array

[Code] .....

View 2 Replies View Related

C :: UDP Application Simulate Packet Loss

Aug 12, 2014

have udp server-client application written in C. On the client side packet loss is detected using recvfrom function and sequence numbers of packets. How can I now simulate dropped packet's on the client side, for example if server is sending 1000 packet I want to drop 20% of them? I want to do this in the code, not for example using ip tables or WANEM or something like that. And one more thing, I have few clients and I want that they can dropped different packets, not the same one.

Code:
while(1){
nbytes = recvfrom(socket, buffer, MAX_SIZE, 0, (struct sockaddr *) &srv_addr, &addrlen);
if (nbytes != -1) {
// packet is received

}else{
//packet is not received
}
}

View 2 Replies View Related

C++ :: Simulate Random Walk In 2 Dimensions

Jan 6, 2015

I am writing a piece of code that simulates a random walk in 2 dimensions (an object chooses whether to move up, down, left or right randomly). I would like the program to run the simulation for many objects at the same time. The way i have written it means that for every object i add the code becomes about 40 lines longer. Any method that would simplify the code so that i could have many objects but not pages and pages of code.

#include <ctime>
#include <cstdlib>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<fstream>

using namespace std;
double dist(int a, int b);

[Code] .....

View 5 Replies View Related

C++ :: How To Simulate File Space Allocation

Mar 29, 2014

I want to write a c++ code that due the structure of file space allocation,Simulates file system with 2*n array. Each column represents a sector. The first row is for storing files And second row holds the address of the next sector (Number of columns). And With each click on keyboard Create a file with random size and automatically find Appropriate sectors by using disk allocation method (or index allocation)... Also File names should be asked from user... And we should have file table Where the starting address of each sector,file extension and file size is given..

View 1 Replies View Related

C++ :: Implementing Class To Simulate A Disk

Oct 1, 2013

So this code compiles without any problem but it is not producing the correct output. I know there's a problem in either my getBlock or putBlock functions but I can't see it.

Currently the output is "Should be 32 1s: "
"Should be 32 2s: "

There should be 32 1s and 32 2s and nothing is coming out.

#include <iostream>
#include <fstream>
using namespace std;
class Sdisk {
public :
Sdisk(string diskname);

[Code] .....

View 3 Replies View Related

C++ :: Get Live Data To Simulate Algorithm?

Apr 9, 2014

How to get live streaming of stock data from yahoo finance? Using C++. I need the code and fetch the data so I can do calculations on the price and volume or what not.

View 1 Replies View Related

C/C++ :: Can Use Packed Structure To Simulate Memory?

Oct 11, 2013

I am trying to simulate memory in C. I want to create a structure in C that will hold a 8bit opcode and a 32bit memory address. This would simulate a 40 bit instruction for my simulator.

I read in an old book that packed structs could be used for this to not waste space. What are the draw backs for using this? I am not worried about wasting space, but just looking for a simple way to access the memory instructions. Below is a sample of the structure that I want to use.

struct memory_area {
unsigned int opcode:8;
unsigned int address:32;
};

View 2 Replies View Related

C# :: Event Into Array?

Feb 18, 2015

i need to change the text in multiple ComboBoxs. i could do it one by one, but i have about 11 i need to change. i feel like doing it one at a time is not efficient. i was wondering if i can put the comboboxs into an array so i can use a for loop to change them all with out writeing it out 11 times.

View 9 Replies View Related

C# :: How To Reuse Event

Apr 14, 2014

I am creating one c# project. In this project I have one mdi form and many child forms.

All the child forms contains one panel named as panel1.

Now when child form opens i use the following code in all child form all child forms' load event contains the following line.

this.WindowState = FormWindowState.Maximized;

and all child forms' resize event contains the following line.

panel1.Left = (this.ClientSize.Width - panel1.Width) / 2;
panel1.Top = (this.ClientSize.Height - panel1.Height) / 2;

so my question is if possible that the above code i write only once so i donot write this code in all the child forms load and resize event.

View 2 Replies View Related

C :: Simulate Process Of Placing CDs In CD Container Using QUEUE

Sep 16, 2014

I'm in need of the C program which will simulate the process of placing and removing CD's in CD container using QUEUE.

View 4 Replies View Related

C :: Simulate Roll Of A Dice - How To Use Rand Function

Sep 23, 2014

I saw a program in which it uses rand like this:-

d1=rand() % 6+ 1;

where, d1 is any integer. The program is to simulate the roll of a dice. The whole program is this:-

Code:

#include<stdio.h>
#include<stdlib.h>
main() {
int i;
int d1, d2;
int a[13];

[Code] .....

View 10 Replies View Related







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