35 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for JohnMcPherson

Hello, I work at the U.S. Department of Labor, on the Unemployment Insurance program. I am working on developing a new Benefit Financing model for the state of Oregon, and I am having an issue with passing a struct between mutiple .c and .cfn files( the .cfn files are for …

Member Avatar for JohnMcPherson
0
611
Member Avatar for it@61@sec

I have the following struct definition: struct finfo { string filename; long fsize; bool operator() (finfo i, finfo j){return (i.fsize > j.fsize);} } fstruct; And the following vector definition: vector<finfo> fdata; In the code I use the following statement to sort the vector elements by fsize: sort(fdata.begin(),fdata.end(),fstruct); This works perfectly …

Member Avatar for it@61@sec
0
957
Member Avatar for Stefan_2

Okay. This weeks 'problem' is that I need to simulate a game. I have to make two singly linked lists which will contain a name of player, his attack (double/float) number and his defence number and so on for as many players as the user inputs. The point of the …

Member Avatar for Stefan_2
0
322
Member Avatar for owenransen

I have a linear array of structs. These are constant structs and is a way of holding a simple table. Now though I need to add another "column" to the table (another member in the definition of the struct) and I'm wondering if I'd be better using a class rather …

Member Avatar for owenransen
0
331
Member Avatar for bejfake

Hi, I have such simple structure in unmanaged C++: struct Cam { char ip[16]; char login[16]; char pass[16]; char name[16]; }; and C# marshalled structure: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] public struct Cam { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string ip; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string login; …

Member Avatar for bejfake
0
2K
Member Avatar for robert.speciale

I have a void function that takes data from an ifstream, reads the first value, (which is an ID #), and compares that value against the ID# info from an array of records. If it's invalid, the rest of the line is ignored. If it's valid, it adds the hours …

Member Avatar for robert.speciale
0
234
Member Avatar for JE821

I'm not sure if I'm freeing the memory correctly. I have the following struct and I'm trying to free the pointer in it. typedef struct RECORD { char* name; int score; }RECORD; In my main function I have an array of this struct, therefore I'm using a loop to free …

Member Avatar for JE821
0
274
Member Avatar for jongiambi

Hi. Im trying to write a simple deck of cards program. I am having difficulty in expressing my integer deck into a printable form. The deck is generated as this: 00102030405060708090100110120011121314151617181911011111210212223242526272829210211212203132333435363738393103113123 The leading numbers assign to suits and the following number assign to card rank. Basically how can I convert …

Member Avatar for VernonDozier
0
8K
Member Avatar for dancks

So, I'm using allegro game programming library. Before I move on to bigger and better things I wnat to get a handle on pointers. Specifically with things like structs, linked lists and maybe binary trees in the future. I posted a program that uses a linked list to keep tracks …

Member Avatar for dancks
0
301
Member Avatar for Vish0203

I wrote this program... Just gave a try!! i got a problem with searching a string in file.. the **"checkp"** used in the login function, returns a value **"1"**, whereas it must return a value **"0"** Hence my program fails... what i felt is, the file i'm opening, **"web_reg.txt"**, in …

Member Avatar for Vish0203
0
185
Member Avatar for hwoarang69

iam trying to store all the data in to a struct so i can change it later. //this data is in file abc 1 11 22 def 2 33 ghi 0 22 11 33 asd 2 i was planing on making a array of structs. so 1st line will have …

Member Avatar for hwoarang69
0
220
Member Avatar for abed1986

Hello everyone, I have a program that intends to create a doubly linked list of structures, using the following header (q1.h): [CODE=c]typedef struct lNode* ListNodePtr; typedef struct lNode { char* string; ListNodePtr next; ListNodePtr prev; } ListNode; [/CODE] This is my implementation: [CODE=c]#include "q1.h" #include <stdio.h> #include <stdlib.h> #include <string.h> …

Member Avatar for abed1986
0
803
Member Avatar for benclifford

Hi, I have a task to perform which all to do with the smurfs, reading from a file and doing some simple stuff to it. The last part I need to do is print out a list of all smurfs and their corresponding role in alphabetical order. I am hoping …

0
225
Member Avatar for scottd82

Hey everyone, I wrote some code to create a deck of cards, described the deck and randomly deals 5 cards. First, I want to let everyone know that this is homework for my C-II college class, so I am not looking for any answers, but solutions or guidance in figuring …

Member Avatar for WaltP
0
1K
Member Avatar for cool_zephyr

Hello there..i'm trying to implement a tree in C#..the basic node structure is give below [code] struct node { public int _x; public int _y; public int _cost; public node _parent; public pos(int i, int j,int cost,pos parent) { _x = i; _y = j; _cost = cst; _parent = …

Member Avatar for cool_zephyr
0
155
Member Avatar for A&M_guy

I am new to structs and I am trying to sort an array of structs but I can't seem to get it to work, I can't figure out what I am doing wrong and any assistance would be very much appreciated! [CODE]#include <iostream> #include <fstream> #include <iomanip> using namespace std; …

Member Avatar for A&M_guy
0
264
Member Avatar for janet@123

i am receiving a struct from the switch: [CODE]/* Packet received on port (datapath -> controller). */ struct ofp_packet_in { struct ofp_header header; uint32_t buffer_id; /* ID assigned by datapath. */ uint16_t total_len; /* Full length of frame. */ uint16_t in_port; /* Port on which frame was received. */ uint8_t …

Member Avatar for janet@123
0
264
Member Avatar for C++newbie chick

Hello guys, just wondering why my program crashes when I try to delete a struct from my array. I'm trying to code so that the user searches for a student via a student ID, then opt to delete the searched student's record. I thought I got it right and the …

Member Avatar for chandara
0
847
Member Avatar for Cainer

Hi, I am using WinSock library for sending data over network, and I have a problem. I know how to send data in one struct and receive it on the other side, because there is constant size of structure. But what if I have more structures, each one with different …

Member Avatar for Cainer
0
555
Member Avatar for Macilath

Howdy, I have a few questions regarding the use of ctime within a class. I followed the example on [URL="http://www.cplusplus.com/reference/clibrary/ctime/strftime/"]http://www.cplusplus.com/reference/clibrary/ctime/strftime/[/URL] When the program is like this, it works: [CODE] #include <ctime> #include <iostream> using namespace std; int main(){ time_t current_seconds; current_seconds = time(NULL); //Fills current_seconds with the number of seconds …

Member Avatar for Macilath
0
683
Member Avatar for eviandc

Hi, I'm a beginning C++ student and have an assignment to dynamically create an array of a struct to store students' first names, last names, and test grade scores, and then pass it via pointer to a function that will sort the grades and names in ascending order. I wrote …

Member Avatar for eviandc
0
1K
Member Avatar for Pravinrasal

i create small application in struts but it give me following error : SEVERE: Servlet.service() for servlet jsp threw exception java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491) at org.apache.struts.util.MessageResources.<clinit>(MessageResources.java:57) at org.apache.struts.taglib.html.FormTag.<clinit>(FormTag.java:93) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at org.apache.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:126) at org.apache.jsp.Index_jsp._jspx_meth_html_005fform_005f0(Index_jsp.java:109) at org.apache.jsp.Index_jsp._jspService(Index_jsp.java:87) at …

0
115
Member Avatar for d_panayotov
Member Avatar for rockerjhr
0
199
Member Avatar for tdba.316

After a few months of learning and practicing C++ with the book C++ Primer Plus through Chapter 7, I decided to do myself a little simple program. I started with the decision to try splitting my program into multiple files, and I decided to collect all shared declarations/definitions (*) into …

Member Avatar for tdba.316
0
2K
Member Avatar for Vorwerkj

I have this struct for an item in a to-do list [code=c] struct Task { char description[TASK_DESC_SIZE]; /* description of the task */ int priority; /* task priority */ }; [/code] i'm just not sure how to alter the description while making a task using this [code=c] TYPE createTask (int …

Member Avatar for Vorwerkj
0
117
Member Avatar for Ptap03

Hello, I'm new to this thread but have referenced to it before many times. I have finally joined thanks to all the great responses I have read in the past. Okay, I recieved an assignment which is as follow... "Declare a dynamic array of Person to store the information of …

Member Avatar for VernonDozier
0
442
Member Avatar for jay1648

[CODE] #include <stdio.h> #include <string.h> typedef struct { char firstName[50]; char lastName[50]; int age; }Person; void ModifyPerson(Person*); int main() { Person person; strcpy(person.firstName, "firstName"); strcpy(person.lastName, "lastName"); ModifyPerson(&person); printf("First Name=%s\nLast Name=%s\n",person.firstName, person.lastName); system("PAUSE"); } void ModifyPerson(Person *p1) { //This doesn't modify the original variable declared in main function Person person = …

Member Avatar for N1GHTS
0
2K
Member Avatar for vasilevich

Hello DaniWeb, I am pretty new to this community and overall to the C++ language. Not so long ago i've decided to learn C++. Anyways the problem is: I am trying to make a simple calculator, its very easy my problem is i am trying to advance my knowlege about …

Member Avatar for vasilevich
0
258
Member Avatar for Drakarus

Problem 1: I was wondering if it's possible to add for example the struct below into a binary tree: [CODE=c] struct Appoint { string place; string title; int hour, minute; int durationHr, durationMin; }; [/CODE] I want the above struct to be sorted in the binary tree by hour and …

Member Avatar for Drakarus
0
261
Member Avatar for newworldcoder

I am very new to development and have been sinking my teeth into C#. I have an application that was written in C++ which is out of my depth, and I was wondering if someone could explain how I would recreate this in c#. The application sends message to linux …

Member Avatar for sundip
0
359

The End.