C++ :: Queues Program Suddenly Stops Working When Input Value

Feb 22, 2013

I'm having troubles with this program I made. Put it simply, it's a basic program using Queues. Whenever I try to input a value, my compiler(Dev C) suddenly stops working. The .exe file crashes and I've no way on how I can execute my program.

Code :
#include<iostream>
using namespace std;
int *queue;
int rear, front, queueSize;
void enqueue();
void dequeue();
void display();

[Code] ....

View 1 Replies


ADVERTISEMENT

C :: Exe File Stops Working And Not Able To Enter Data

Sep 13, 2013

I am trying to enter data to a structure some 8 times, but not able to do so. Here is my code.

Code: #include<stdio.h>
struct _Timer {
unsigned int HH;
unsigned int MM;
}Time[8];
[code]...

But when I enter any data and press enter , the .exe file stops working and not able to enter data.

View 4 Replies View Related

Visual C++ :: Find To Look For Variable Stops Working?

Oct 3, 2013

Just using Find in my source code to look for variables or whatever, works once or twice then just stops - Doesn't find anything even if it's there. If I restart VS it works again, but not for long.

View 1 Replies View Related

C++ :: Play Sound On Key Press - Stops Working After A Few Seconds

Sep 15, 2012

I'm making an apllication which needs to play .wav file when user type something inside QTextEdit. I made some code but after minute or less the sound stops, so I made silly workarround. After 30 clicks I invoke sound->stop(); and then the loop start again, that works, but it's not good, can you give better solution. Here is my code:

Code:

int count = 0;
bool MainWindow::eventFilter(QObject *o, QEvent *e){
if(e->type() == QEvent::KeyPress)
{
tipka->play();
tipka->seek(0);

[Code]...

View 1 Replies View Related

C++ :: Program To Allow A User To Input A Number From Keyboard That Involves Loop Not Working Right?

Mar 30, 2014

I'm trying to write a C++ program that will allow a user to input a number from the keyboard. Then using a loop, that will perform 10 times, multiply the entered number by the loop counter. Print out the loop counter, the entered number and the product of the loop counter and the entered number. A one-time heading should be displayed before information is printed.

This kinda of what I have so far:

#include <iosteam>
using namespace std;
int main () {
Start
Declare: numScores, sum, score, avg, SENTINEL = 200
numScores = 0

[Code] ....

All the programs I have tried to make are not working?

View 4 Replies View Related

C++ :: Address Book - Program Stops After Cin

Dec 6, 2013

the program is of an address book. the syntax is all fine, and the initial menu of options does show up. but once you punch in the cin, the program just stops.

View 9 Replies View Related

C++ :: Fseek - Program Crashes And Stops Responding

Feb 9, 2015

i wrote a little program with fseek. It works good till it reaches the first fseek(). Then it crashes and stops responding.My code:

ifstream inp("myfile.txt");
if(!inp.is_open()) return false;
inp.close();
FILE *f;
fopen("myfile.txt","rb");

[code].....

View 2 Replies View Related

C++ :: Need To Enter More Than One Char Input Not Working

Jan 23, 2015

Basically I'm having trouble reading more than one character.I want the user to input character traits(ie, w, a), if two traits are entered they get the job.

But I cannot get my program to read more than one character input.

This is what I have so far...

#include <iostream>
using namespace std;
int main(){
char input;
int count = 0;

[Code] .....

View 6 Replies View Related

C++ :: Loop Not Working User Input?

Jan 20, 2013

Some of my loop is not working. How messed up is this code.. Commented non working code

// ADIT.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "windows.h"

[Code]....

View 3 Replies View Related

C/C++ :: Do While Loop Not Working - Exits After Input

Feb 6, 2014

My code:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int factorial(int n);
int main() {
int n,num;
do {

[Code] ....

My while loop is not working... it exits after 1 input...

View 3 Replies View Related

C++ :: Hash Tables And Queues

Jun 3, 2013

For my homework I need to create a hash table with a size of 7. I also need to create a queue that holds 3 names maximum for each table position

View 1 Replies View Related

C++ :: How To Access Vector Of Queues In Two Functions

Jan 20, 2013

I have the following code which will find the minimum size queue among a vector of queues and the minimimum size queue will enqueue(push) the int

std::vector<std::queue<int> > q
void enqueue(){
int min_index = 1;
std::size_t size = q.size();
for( i=2; i<size; i++) //accessing loop of queues
if(q[min_index].size() > q[i].size())
min_index = i; // Now q[min_index] is the shortest queue
q[min_index].push(int)
}

Now my another paradigm is to do the dequeue(pop) operation in another function(shown below), bt i need to access all vector of queues declared in enqueue() function. how can i access the loop of queues given in the enqueue() function?

void dequeue(){
//q.pop operation , access all the queues in the loop of queues
}
willq[i].pop(int);

Access all the queues in the enqueue function and does the pop operation?

View 1 Replies View Related

C++ :: How To Search The Loop Of Queues Of Vector

Feb 14, 2013

i have a paradigm where a integer before gets enqueued to a queue, the loop of queues in a vector is searched and integer is enqueued to a queue which has minimum size among the queues. the following code shows the operation.

#include <vector>
#include <queue>
std::vector<std::queue<int> > q
int min_index = 0;
std::size_t size = q.size();
for( i=0; i<size; i++){ //accessing loop of queues
if(q[min_index].size() > q[i].size())
min_index = i; // Now q[min_index] is the shortest queue}
q[min_index].push(int)

next i am trying to extend my paradigm with that the condition the integers should be enqueued to the shortest queue until it becomes maximum size among the queues.

do{
q[min_index].push(int)
} while(q[min_index].size > queue sizes in the vector loop except this queue )

how to search the loop of queues of vector in the while ()

View 13 Replies View Related

C++ :: Input / Output Text File Manipulation Not Working

Mar 24, 2013

Why my output screen for this program does not want to stay open. It only opens for a split of a second and it's gone. The program is supposed to take numbers from a input file and display and save the manipulation in the output file. Here is the program.

Code:
#include<iostream>
#include<fstream>
#include<iomanip>
usingnamespace std;

[Code] ....

View 6 Replies View Related

C++ :: Printing Double Triangle - Working Fine Up To Input 7

Feb 22, 2013

I wrote code for printing a double triangle. Its woking fine upto input is 7. but when the input is 8 the output is disturbed. the code is this.

#include<iostream>
using namespace std;
int main() {
int a;
cout<<"Enter a number"<<endl;

[Code] ....

View 3 Replies View Related

C :: Ferry Loading Using Two Queues - Can't Enter In Data After First Set Is Scanned

Feb 25, 2014

I'm trying to solve the ferry loading problem using two queues. My problem is I can't enter in data after the first set is scanned in, I'm assuming there is a problem with my loop, such that the scan function doesn't get called after one iteration. In the example I marked the data I can't enter. An example correct input would be:

correct input:
1 - can enter data20 4 - can enter data
380 left - can enter data
720 left - can't enter data
1340 right - can't enter data
1040 left - can't enter data

correct output: 3

my incorrect output: 1

Code:

#include <stdio.h>
#include <stdlib.h>
#include "my_linked_list.h"
#include "my_linked_list.c"
#include "status.h"

[Code] ....

View 6 Replies View Related

C++ :: Creating List Of Medical Resources And Their Attributes - Input To Structure Array Not Working?

Mar 23, 2014

I wrote this program to create a list of medical resources and their attributes, a task I have been performing repeatedly lately. I'm still fairly new to C++, so I thought to create a structure "Resource", and then an array of those structures "city[300]". My problem is that the input doesn't seem to be happening: the program runs, but when it prints to screen/writes to the file at the end, all the shows is:

Resource Type:
Name:
Address:
Phone:
Website:

for every resource that was input. All the fields are blank.

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
struct Resource {
string typeID;
string name;

[Code] ....

View 1 Replies View Related

C++ :: While Loop Stops Output

Jun 19, 2014

As I was testing it, the program suddenly stopped giving an output. Here is the code:

#include <iostream>
using namespace std;

int main() {
cout << "Ten people ate breakfast with you this morning. Each of them " <<
"had pancakes.
Please enter how many pancakes each of the ten people " <<
"ate.
" << endl;

[Code] ...

The while loop after int glutton does not work and seems to stop the program. I replaced the "glutton" in the cout with "testing testing" and it still did not work. However, when I commented out the loop, it appeared. Finally, it can't be what's inside the loop, because I commented that out too, and it still didn't work.

View 2 Replies View Related

C++ :: Code Stops Executing After GetScores Function

Nov 11, 2014

I am currently working on a c++ project that will input students and process their grades. I encountered a problem and my code stops executing after the getScores function. Im not sure what the problem is, but im guessing its something within the function and the loops.

//Name: getScores
//Description: Will get scores for student
//Parameters: None
//Return: testScore
double getScores()

[code]....

View 6 Replies View Related

C++ :: Eight Queens Program Not Working?

Feb 3, 2015

I'm a bit stuck on a program that prints out a 8x8 chessboard and Q to represent queens where the user enters input. The intended output is: Code: Enter the columns containing queens, in order by row: 0 3 4 0 0 7 6 7

Q.......
...Q....
....Q...
Q.......
Q.......
.......Q
......Q.
.......Q

but instead I get Code: Enter the columns containing queens, in order by row: 0 3 4 0 0 7 6 7

.Q
.Q
.Q
.Q
.Q
.Q

[code].....

View 2 Replies View Related

C :: Arithmetic And Guessing Game Program Not Working Right

Nov 8, 2013

I am relatively new to C programming, and I am encountering numerous issues with this program that I cant seem to figure out how to fix.

First, when the user selects the arithmetic game, I keep on getting different incorrect answers from the arithgame function. For example, when I am presented with the question 3+2=_, sometimes the function claims the answer is the first number, 3, and other times the function gives me a multiplication answer, 6. This happens in both the addition and multiplication parts (ie. the multiplication answer will either be the first number or the addition answer).

Additionally, I cant figure out why my guessing game loops forever, rather than letting me guess until I get a correct answer.

View 2 Replies View Related

C :: ATM Program - Withdraw And Fastcash Functions Are Not Working

Apr 19, 2013

My ATM program compiles but my withdraw and fastcash functions are not working right in my program.

Here is my program:

Code:
#include<stdio.h>
#include<stdlib.h>

int fn_balance(int *);
void fn_deposit(int *);
void fn_withdraw(int *);
void printReceipt(int *);
void mainMenu(int *);
void FastCashMenu(int *);

[Code] .....

View 1 Replies View Related

C :: File Attribute Modification Program Not Working

Mar 27, 2013

I would like to modify attributes like modification/creation dates.The function is correctly working as if I type in "ls -al", the timestamp is correct. But when using my program to read these attributes, it returns the "real" modification/creation date. Here is the function that shows the timestamp :

Code:

time_t t = sb.st_mtime; struct tm tm = *localtime (&t);
char s[32];
strftime (s, sizeof s, "%d/%m/%Y %H:%M:%S", &tm);
printf ("%-14s %s", lecture->d_name, s); And here is the code for modifying the timestamps : Code: void modifyAttributes(char * file, int mtime, int atime)
}

[code]....

View 9 Replies View Related

C++ :: Delete Operator Is Not Working - Program Crashes At The End

Jan 12, 2013

int main() {
int vnum = 0;
VEHICLE *vehiptr;
VEHICLE *dptr;
cout<<"Please enter the number of vehicle: ";
cin>>vnum;
vehiptr = new VEHICLE[vnum];

[Code] .....

View 9 Replies View Related

C Sharp :: How To Pick Date / Time When Serial Port Starts Reading And Also When Stops

Aug 18, 2014

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.Ports;

[Code] ....

How to pick date / time when serial port starts reading , and also when reading stops ?

View 2 Replies View Related

C++ :: Cout Statement Not Working - Program Outputting Zero For Variable

May 20, 2013

Why is my program outputting zero for the variable pop?

Code:
#include <iostream>
int main(void){
using namespace std;

//capture data
cout << "Enter the world's population: ";

[Code] ....

It's obviously not std::cout, but I'm thinking its the way I'm operating on long?

View 5 Replies View Related







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