109 Topics
|
|
I was looking at this struct tutorial. https://www.tutorialspoint.com/cprogramming/c_structures.htm It mentions "The structure tag is optional". How would you refer to your struct if there is no structure tag? struct { char title[50]; char author[50]; char subject[100]; int book_id; }; //something like this? struct random_name; |
|
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 … |
|
Hi All, I below code snippet I have been using diff-2 structure with same variable due to having different -2 default values for the variable (var) in current implementation for both the structure a and b. This way i need to create 17 structure with same variable (var) but different … |
|
I had a function I used a while back to test the pixel colors in a given screen rect, it was something like this pseudo code. for (int y = t; y <= b; y++){ for (int x = l; x <= r; x++){ color = GetPixel(hdc_, x, y) & … |
|
This Go snippet calculates the minimum number of bills or coins needed for a given amount of money (change) requested. The program also gives the denomination and number. US curency is used in this example, but can be changed to another currency. |
|
Another little adventure into Go coding. This time a slice (a Go open ended array) of structures is used as a record for some data processing. For those who miss the ; at the end of a line of code, you can use them, but the lexer of the compiler … |
|
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 … |
|
I'm working on this code for class, I am not expecting anyone to do my homework but help would be appreciated. Nodes are confusing for me and my professor did not explain well. The errors I am getting are where I declare the functions, I dont know the nodeType(?) that … |
|
Hi! I was doing my exercise of C Language. In the exercise I was encountered by a question in which author says you to perdict the correct answer; I was uable to perdict it, so I compiled it to get the answer, the source code is this: #include <stdio.h> int … |
|
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 … |
|
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 … |
|
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; … |
|
I wrote a game using an array of structs to represent a 9x9 grid. Now I'm re-writing it as a class to '++ it up' a bit and to better understand classes. Part of the game used a seperate struct to keep track of selected board squares (to see if … |
|
Here's a little program i wrote, i'm trying to pass my structure book to function input. The code works fine on Code::Blocks but VS12 is giving an error on compliation " error C4700: uninitialized local variable 's' used ". What i'm doing wrong? #include <string.h> #include <iostream> using namespace std; … |
|
Hello, Am new in Struct I followed link http://www.tutorialspoint.com/struts_2/struts_examples.htm for making simple hello project in struts using eclipse but when i complete the coding and go for the execution, when I write the word in that box as an input (for saying hello). and click on Say Hello button, it … |
|
I'm working on a struct array and I need to dynamically delete elements from the struct. I have the added dynamically but I've run into some issues with deleting. I've researched different methods and tried a few. I found that one from here works, in that it will delete the … |
|
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 … |
|
How do I define a typedef struct in function f1() and pass a pointer to function f2() without a global definition of the struct. For instance: Also I would like this to be in C but not in C++. I have no toolbar, so I cannot put the code I … |
|
|
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 … |
I'm coding a contact manager using a doubly linked list that is manipulated by functions using pointers that reads in a contactList.txt file.But when I coded the first function to do a search I got the following error list: Error 8 error C2059: syntax error : ')' C:\Users\Brian\Documents\Visual Studio 2010\Projects\G00290342Manager.c\G00290342Manager.c\ContactManager.cpp … |
|
I would like to convert a procedural database program that I have created to an object oriented program. In my procedural program I use a struct: struct shoes{ char Name[20]; int Number; double ShoeSize; }; Putting this into a class would I simply use: class Shoes{ public: //Function declerations private: … |
|
Hi, I've not worked in C, C++ from like 5-6 years. But now I got to do a very small change (explained below). I tried reading tutorials but only got confused. Below I've struct containing 2 attributes. I need to create its refrence and pass values to these 2 attributtes. … |
|
**guys I wrote this, there's no errors, no warnings... but it keeps crashing on execution.. any ideas ?????** #include <stdio.h> #include <stdlib.h> #include <string.h> struct data { char * name ; int grade ; }; int compare_ints(const void *a, const void *b); int compare_strings(const void *x, const void *y); struct … |
|
Develop a telephone directory which is capable of doing the following: 1. Insert a contact 2. Delete a contact 3. Edit an existing contact (changing or modifying a record) 4. Search a contact (and display complete record on screen) a. Search through first name b. Search through last name c. … |
|
Hey guys, So I've thoroughly gone through the topics by searching this site but I couldn't find something which can help me. I'm making a task for my friend and let me tell you that it's been a year or more since I've used C++. I've moved on to C# … |
|
typedef struct zoz { int age; int mag; int suly; } nevsor_t; int olvas(nevsor_t * pnevsor) { return scanf("%d %d %d", &pnevsor->age, &pnevsor->mag, &pnevsor->suly); } int kiir(nevsor_t nevsor) { return printf("%d year\t%d cm\t%d kg\n", nevsor.age, nevsor.mag, nevsor.suly); } int sort_age(const void *a, const void *b) { struct nevsor_t *ia = … |
|
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 … |
|
hello everyone i'm new ic and i have a problem on structs, on the very simple i want to create a struct with one int and a char table 3 potisions,this is my code #include <stdio.h> #include <string.h> #include <conio.h> struct domi { int code; char name[3]; }; main() { … |
|
Hi everyone, I'm currently working on a school assignment and came up with this error saying 'list_t has no member named head' but when I actually look at list.h and list.c (my code accessing list is in a separate file), head is in list.c. What did I do wrong? list.c … |
|
The question asks: Write and compile a C++ program that simulates the arrivals of airplanes at Regina airport. An airplane is represented using a C++ struct. Each plane belongs to an airline, such as United, and records the city from which it is arriving, for example Chicago. The airport is … |
The End.