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


ADVERTISEMENT

C++ :: Creating Tree Like Structure Using Linked List

Apr 25, 2014

How would I go about creating a tree like structure using linked lists, I am thinking of making a rubix cube solver program, what I want to do create nodes that each do one operation like turn left, right, up, down but I dont know how to go about starting this.

View 2 Replies View Related

C :: Bitfield Array - Using Standard Technique Of Creating A Structure Within Union

Mar 27, 2013

Any way that one could create a bitfield using the standard technique of creating a structure within a union, as follows:

Code:
typedef union {
struct {
unsigned b0 : 1;
unsigned b1 : 1;
:
:
unsigned b(n-1) : 1;
} bits;
unsigned int value;
}

BIT_FIELD_TYPE; Except, what I'd like to do is to replace all the single-bit elements in the bits structure with a single statement that creates an array of, say, 32 values. The clear advantage of this is that it could be traversed using an iterator, ...

Code:
main() {
BIT_FIELD_TYPE foo;
unsigned int i;
...
for (i = 0; i < n; i++) {
... (print out foo.bits.b[i]) ...
}

So far, I've not figured out a way to do it, either as an array, or using a pointer to iterate through the individual bits.

View 6 Replies View Related

C++ :: Program To Save List Of Items With Associated Attributes

Nov 22, 2012

I'm supposed to write a program that is able to save a list of items such as books, CDs, or DVDs. The items that are saved must have attributes associated with them. For example a book has a title, author, publisher, and ISBN.

I'm supposed to create a program that is able to save the database of items to a file on the hard drive and also retrieve it from the hard drive.

The user should be able to

1. Enter items
2. Display a list of the items
3. Save the list to disk
4. Read the list from disk
5. Sort the list
6. Exit the program

I know I should use arrays and structs but I don't where to start.

View 2 Replies View Related

C/C++ :: Creating Singly Linked List / Loading Class Type Array

Aug 6, 2014

I've written this class and struct to create a singly linked list. The data is stored in the binary file which I've opened and read. I'm trying to load said data into a class type array. The errors I'm getting are "incompatible types in assignment of 'StatehoodInfo' to char[3]" Lines 130-134 is what I was working on.

#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring> //For char[] string functions

[Code] .....

View 2 Replies View Related

C++ :: OpenGL - Does Vertex Array Object Store Enabled Attributes

Jan 8, 2014

Does the VAO (glGenVertexArrays/glBindVertexArray/glDeleteVertexArrays) store the enabled/disabled state for the Vertex Attributes (glEnableVertexAttribArray/glDisableVertexAttribArray) or should I re-enable them every time?

View 1 Replies View Related

C++ :: Medical Dictionary - Spell Check Terminology

Sep 28, 2013

A friend of mine is taking classes currently and using open office. He asked if I could create a program that would spell check medical terminology. He said that he has a program that works with Microsoft word but it will not work with open office.

View 6 Replies View Related

C++ :: Why Does HP / Microsoft STL List Use Same Structure For List Head And Node

Apr 23, 2013

From HP / Microsoft (Visual Studio C++) <list>:

Code:
struct _Node
{ // list node
_Genptr _Next; // successor node, or first element if head
_Genptr _Prev; // predecessor node, or last element if head
_Ty _Myval; // the stored value, unused if head
};

The stored value is wasted space for the list head. Is there any advantage to implementing list using the same structure for a list head and node?

View 6 Replies View Related

C++ :: Linked List Not Working?

Jun 28, 2013

#include <iostream>
#include <string>
#include <iomanip>

[Code].....

View 3 Replies View Related

C++ :: Using Resources In Executable?

Sep 8, 2014

i have seen a lot of programs that have images inside their exe, dont use external ones. I tried to add image in my codeblocks project, but trying to use it failed. It seems that to use a resource i have to add some kind of header file, but how to do this???

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# :: Ordering Of Embedded Resources

Oct 14, 2014

I have 10 or so .sql scripts (the number is likely to rise) which are required to be kept with a C# application.

For the most part the embedded resources seem to work fine , however I require a way in which to guarantee the ordering in which the files are run.

What I do currently:

Retrieve the details of the embedded resources using : Assembly.GetManifestResourceNames()

(and a bit of linq to filter based upon my requirements) which I pass to a list, I then later on use the list to grab the physical resource when its needed.

The files are named such as:

1_ScriptDescription.sql
2_ScriptDescription.sql
3_ScriptDescription.sql
10_ScriptDescription.sql <--- Here's my problem! This will come after 1_ScriptDescription.sql

Ideally I need a way in which to order the list or some kind of ordering when I pull from

Assembly.GetManifestResourceNames()

But I'm not really sure of a practical way to do this, I did consider manipulating the string .....

View 3 Replies View Related

C# :: Edit File In Resources?

Feb 12, 2015

What i'm trying to do is compile a text file to an executable, but the problem is that I want to be able to edit the resource file while in runtime, for example write something on a textbox, hit compile and get the executable file edited by the texbox.

Here's my codedom:

public static bool Compile(string sourcefile, string exefile) {
CSharpCodeProvider ccp = new CSharpCodeProvider();
CompilerParameters cp = new CompilerParameters();
cp.ReferencedAssemblies.Add("System.dll");

[Code] ....

Is there anyway I could do that?

View 2 Replies View Related

Visual C++ :: Viewing Resources In A DLL

Dec 12, 2013

Any utility that would allow me to display the resources in a DLL? i.e. if the DLL contains icons / bitmaps etc I'd be able to view them. I've a feeling that such a tool exists but I can't remember what it's called.

View 1 Replies View Related

C/C++ :: Structure Competitor - List Of Contestants

Apr 9, 2015

This is structure:

structure competitor {
int password;
string last_name;
string first_name;
float score;
};

Write a program that processes the list of contestants on the competition,during the work program, the program offers an appropriate menu:

1.Enter new competitor;
2.Remove competitor with password;
3.Change data competitor with password;
4.Sort competitors in descending order of score;
5.Tabulation of rank list;
6.Writing data to a text file;
7.Download data from a text file;
8.End of the program.

Each of the individual actions realised with appropriate function. Use precision of two decimal places

View 3 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++ :: 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 View Related

C++ :: Linked List - Structure Naming Syntax

Feb 21, 2014

I am looking at a linked list example, which uses structs:

typedef struct node {
int val;
struct node * next;
} node_t;

As you can see, we provide an optional name "node" that follows the word struct. And we can use "node" subsequently as a shorthand for the part of the declaration in braces.

But what is that node_t for? What is that doing?

View 4 Replies View Related

C++ :: File Input And Output Structure

Jul 17, 2013

How to structure the input of one .dat file and outputting into another one. I have to loop through a file structured "doe, john, 1500", check for errors and then increase the mp by 50. You also have to do this through using a person class too. I think I need to use a while loop to go to eof and use getline to input correctly, but im not sure how to structure it.

Data file:
Horowitz,Jake,1200.24
Flabitz,Bubba,1712.38
Blackwell,Sharon,1872.93
Molerat,Rufus,501.00
Goodall,Jane,1567.43
Sommerset,William,1359.57

[Code] ......

View 4 Replies View Related

C++ :: Creating Methods For Class List?

Jul 3, 2013

Creating the methods for class List

main.cpp Code: #include "List.h"
int main( )
{
List la; // create list la
la.push_front( "mom" );
la.push_back( "please" );
la.push_back( "send" );
la.push_back( "money" );
la.push_front( "hi" );
cout << "
la contains:
" << la << '

[code]...

View 12 Replies View Related

C++ :: Creating Circular Linked List

Jan 30, 2015

I've been making a circular linked list and I'm trying to assign each list a "name" and its next "link" but when I run my code it crashes.

Soldier *Head;
Head = NULL;
string names[] = {"Arman","Bogut","Castro","Damascus","Elene"};
for (int i = 0; i < 5; ++i) {

[Code] .....

View 4 Replies View Related

C# :: Creating A List Of Lists On Xamarin

Aug 20, 2014

I would like to have a List with Lists. (every list with have strings ints and i would like to be able to have all the lists in a array) is this approach too expensive and i will have problem with the memory or something? is it better if i have a list with the names of the lists and access them that way?

In order to give a better understanding of what i need this is what im trying to do but throws errors:

public List<MusicItem> Theme1 { get; set; }
public List<List<MusicItem>> AllThemes { get; set; }
AllThemes = new List<List<MusicItem>> {
Theme1 = new List<MusicItem> {

[Code] .....

View 14 Replies View Related

C++ :: Template Partial Specialization - Combining Two Types Of Resources

May 15, 2013

I want to write a template that combines two type of resources:

class someClasses {
typedef someType ElementType;
} template<class T1,class T2>
class combo {
...
}

And I want to specify my T1 and T2 has the same ElementType, how can I write my combo class to partial specialize the general case so the ElementType check is at compile time?

View 9 Replies View Related







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