C :: Create A Structure To Store Information About Products For Sale
Apr 29, 2013
I am using Dev C++ compiler on Windows 7 and was programming a piece of code that is supposed to do the following -
Create a structure to store information about products for sale in a store. It should store information about the product name, the price, and the product number and then create an array of products called Inventory. Add five products to your inventory.
But for some reason, which is unknown to me, I always seem to get a compiler error. And this is what i have so far -
Directions: Write a program that uses the structure named MovieData to store the following information about a movie:
Title Director Year Released Running Time
Include a constructor that allows all four of these member data values to be specified at the time MovieData variable is created. The program should create. The MovieData variable and pass each one in turn to a function that displays the information about the movie in a clearly formatted manner. Pass the MovieData Variables to the display by value.
I need to be able to make matches from the data i input, and also classifying between male and female. matches for person with specific traits (not one in the program) i really tried for the first part and now the rest is mentally disturbing me. and also to generate a report of partners found.
#include<string.h> #include <iostream> using namespace std; char username[20]; char storedusername[20]; char password[20]; char storedpassword[20]; int loginresult; char name[20];
Given a product category and subcategory representation:
a. Come up with a tree data structure to minimally (in terms of storage) represent this b. Write a program to convert the given representation (shown in example below) to this c. Write a function to output the tree structure in a nice human readable format
Note: a. There can be any number of levels of depth b. Rows may be repeated in input, but need to feature only once in the final tree.
Example category list (read this input from a file):
I am trying to use an array to keep track of the numbers of channels created and how many times a particular channel has been copied. At the moment, the program sets a number for a new channel (1-20), but the user enters the channel name. The channel name is stored in 'ChannelName' variable and if the user copies the channel, it becomes ChannelName_Copy. I want to change the '_Copy' into an incremental identifier such as _C1, _C2, etc.. and to do this i would need to keep track of the channel name and the number of times it has been copied, which i planned to do using arrays but i am not quite sure how to approach this.
I'm trying to open a file (contains member information) and store the information in an object, which is then inserted into a linked list. However, the current code just leaves a blank command window hanging with nothing happening.
I was trying to make a program in C that could take Personality Information from the user and store it in a text file. Then, when asked, could compare the results to other entries in the so called "data-base" and tell which is the best match. I tried a whole lot but couldn't think of a proper way.
(Stings and File IO are not my strong points)
I am using Code Blocks 10.05 and the standard GCC compiler.
So I have to read from a file, and store the information in separate variables. My problem is that for some of the information I need multiple words, and for others I don't, so I cant simply store 1 word into a variable and store the next in another in so on. To demonstrate what I mean let me give an example.
Dog Cat Blue Bird Snake White Horse
I am able to store "Dog","Cat","Blue","Bird"...etc in variables but I don't know how to make it so I can store "Dog" in one variable, "Cat" in a second variable. and "Blue Bird" in a third variable. "Snake" would be the 4th and "White Horse" would be the fifth. How can I read a file and manipulate the pointer to grab what I need?
I'm trying to read the data from a file i/o and put them into an array of structs. But when I run the program, it gives me a bunch of "garbage" as an output. my code and see
Im trying to read and store several students information so that i can have an options menu where i can enter a student number and the program prints all the information stored about that student. The way i have it set up now, doesn't work for this because all info is reinitialized to stud1. Is there another way to store this info other than defining stud1, stud2,.....,stud200?
how I can read information from a text file into an array so afterwards I can display the array and it will show the contents of the text file?
the information inside my text files consist of names and numbers like so: "Collins,Bills 80" should I separate the numbers and names into two separate text files one for names and one for numbers?
I'm reading through a data structure textbook. I'm doing the part of Linked list. here's the code from the textbook:I'm not clear with pointer.what I'm confused is that the code created a pointer to the structure (*NodePtr)
Q1. Is NodePtr store the address of the structure?? Q2. Are top, np, last address of the structure?? Q3. here.....NodePtr makeNode(int);... does it returns an address of the structure which is np?? but following part np is used as a pointer??
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.
I have one requirement to store an array of structure at shared memory. Also the shared memory should have one counter to store number of elements in the array.
I tried to look at some placed but didn't find anything relevant.
So my first question, is it possible that we can store two things on same shared memory. And second if not then how to achieve the same?
I am writing a program that models the ups & downs of a particular stock. Everything is pretty much done, except that I need to create another event to notify that saves the following information to a file when the stock's threshold is reached: date & time, stock name, initial value & current value. I have something like this so far:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO;
[Code]...
I feel like i need something along the lines of
s.stockEvent += new Delegate( ???? ) in my myFile class so it know when the threshold is reached, to write the information of the current stock to the file.
My program is designed to read input from the user and then store that input in a structure variable. Whenever i use the cin.getline() function, it comes up with a semantic issue. Here is the code:
I created a class (let call it X) which contains the structure to store the data from my data base. Them I have a class (call Y) which will contain a list for each row in my data base. Third, I have a class with thousands variables (Z). What I am trying to do is to take the list of objects (Y) that contains the data to initialize Z. What I want to now if I can do something like that.
Imaging that one of my rows contain the following data: Type Nameofvariable etc... "static const double; MNFAIL ; 0; 0; 0,25"
In my list I have a node with contain this data
I want to use the field Nameofvariable to initialize the variable called MNFAIL contained in my class Z.
Here your supposed to create a program that takes in information and formats it into three columns.
I can't seem to use the float variable unitprice with decimal places here for, if I try to use %.1f and type in an input, the program seems to skip over the second scanf function, not allowing me to put input into the third scanf function as the program runs before I can.
I can use %f on its own and it works but this creates too many zeroes(and you're supposed to set the currency limit to $99999.99).
Code: #include <stdio.h> int main(void) { int itemno, month, year, day; float unitprice;
[Code]....
So the output should look like three columns. It's just the float that is the issue here....
i need to create a new integer data type called BigInt to store a big big integer, which includes Dint(8 bytes) and Qint(16 bytes)
here is the hint/
typedef struct BigInt { Int data[2]; }
How can i "scanf" and "printf" them????
void ScanBigInt(const char *format, BigInt &x) if format is “%dd” -> input Dint, if format is “%qd”--> input Qint void PrintBigInt(const char *format, BigInt x)
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?
This creates quite a mess. It seems that somehow the "vector" declaration isn't working as the referenced web link seems to suggest that it should. I presume that, as usual, clearing one real error will eliminate the cascade of errors the first real error produces. Why won't VC++ accept the "vector" identifier?
The error messages that follow the build attempt are:
Friedman.cpp d:documents and settingsxxmy documentsvisual studio 2010projectsfriedmanfriedmanEinstein.h(22): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.