15,550 Topics

Member Avatar for
Member Avatar for manaila

I have recently come along a struct of this sort: [CODE]struct Context { Context(): addTitle(false) { } bool addTitle; std::string title; };[/CODE] It looked strange, especially the [B][I]Context(): addTitle(false) { }[/I][/B] part. Can anyone please explain it for me.

Member Avatar for Moschops
0
87
Member Avatar for prestige9

Dennis Ritchie died at age 70. Great loss the creator of C and co-inventor of Unix.Few people can truly say they changed the world. And Dennis certainly is one of the few. RIP Dennis, but also thanks for making the world in which we live in today! Thank you Dennis …

Member Avatar for MonsieurPointer
0
121
Member Avatar for liverpiece

How to write a tic tac toe game program in c language using int char array with the help of for & while loop

Member Avatar for liverpiece
0
83
Member Avatar for eagles39

I have written a function to place mines. I need 'X' to be in array position [0][0] I cannot randomize so it does not overlap the mines b/c I can have only four mines in a [4][5] array. The problem I am having so that it checks to see if …

Member Avatar for WaltP
0
421
Member Avatar for BobTheLob

Hey, so I'm having some difficulty getting my make file to work. When I try to make, I get this: [CODE]andrew@Samantha ~/Documents/OS_Projects/Chapter 6 $ ls Makefile Makefile_old semaphore.c andrew@Samantha ~/Documents/OS_Projects/Chapter 6 $ make make -C /lib/modules/2.6.38-8-generic/build SUBDIRS=/home/andrew/Documents/OS_Projects/Chapter 6 modules make[1]: Entering directory `/usr/src/linux-headers-2.6.38-8-generic' make[1]: *** No rule to make target …

Member Avatar for BobTheLob
0
171
Member Avatar for infantheartlyje

Hi folks, [CODE] int a=10,b=5,tmp; tmp=a; a=b; b=tmp; [/CODE] This is ordinary swap. I want to do this swap to the structure variables. And how to free the memory of tmp structure variable after swapping.

Member Avatar for WaltP
0
222
Member Avatar for stinkypete

I've been looking around for code snippets for generating pseudo-random numbers. A lot of them seem to be very similar, for example [CODE]double findnoise(int x) { int x = (x<<13) ^ x; return (double)( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & Ox7fffffff) …

Member Avatar for gerard4143
0
107
Member Avatar for guidely

Hi, I just wondering how to Passing structures of array to functions Here is my code [CODE] #include <stdio.h> struct harbour { int harbourId; int maxCap; int timeUpload; double amount; }; struct ship { int number; int shipId; int sMaxCap; int sActCap; int aTime; }; void readHarbour() { int i=0, …

Member Avatar for thines01
0
219
Member Avatar for dineshz

I have a problem with this code. Why this shows random symbols when i give view data ! ?[CODE]#include<iostream> #include<conio.h> #include<windows.h> #include "gotoxy.h" #include<cstdio> #include<cstring> #include<cstdlib> #include<fstream.h> using namespace std; //function declarations void out(char *); void matrix(int,int); class student { public: //class variable declaration in public part int roll,fee,ht,wt; char …

Member Avatar for VernonDozier
0
584
Member Avatar for kiranroy

[COLOR="Red"][B]ATTENTION!!!!!!!!!!!![/B][/COLOR] [B]HELP..........NEEDssssssssss............[/B] [B][U]how can I implement the C code of the descending tree and ascending tree of PRAM.....in openMp.........?????[/U][/B]

Member Avatar for kiranroy
-1
39
Member Avatar for swissknife007

[CODE] #include<stdio.h> #include<conio.h> #include<stdlib.h> struct node {struct node * left; struct node * right; int info; }; typedef struct node node; node * root=NULL,*loc,*par,*save,*child; int item; void pre(node *); void in(node *); void post(node *); void find() { node * ptr; loc=root; par=NULL; if(root==NULL) { loc=NULL; par=NULL; return; } if(root->info==item) …

Member Avatar for swissknife007
0
247
Member Avatar for ZedChu

Hi, I need to read unsigned integer and I want to read it number by number. I did this function. But it has "one bug". It can't read number like 4 294 967 295. Max what it reads is like 4 294 967 29. It's because I multiplied it by …

Member Avatar for ZedChu
0
225
Member Avatar for annonymous21

I started working on a select server and am encountering some issues. Heres the problem; I ran an strace on my select server and i fired it up and it creates the socket, binds, listens, and select waits for input. When you connect the client, select adds a file descriptor …

Member Avatar for D33wakar
0
129
Member Avatar for infantheartlyje

Hi folks, I want to check two dates. The date format [MMDDYYYY]. for e.g., 01252000 . I want separate the day , month, and year into a integer. How can i do this?

Member Avatar for infantheartlyje
0
345
Member Avatar for infantheartlyje

Hi folks, this is my code. I'm passing a date string [MMDDYYYY](e.g., 01022000) to the function check periods. Now i send the date to sepdate function. This function should separate the dates. if i print the returned array, am getting wrong answer. [CODE] int *sepdate(char *date) { long int dt; …

Member Avatar for infantheartlyje
0
137
Member Avatar for minimi

This is what I have so far. I have to create array of 10 int values as local variable then iterate through the array elements using pointer, print address, and value of the each item. But this is my output. It should print values from 0 to 10, but mine …

Member Avatar for gerard4143
0
134
Member Avatar for aKiLa.. :)

i want to do a project in c programming.. what topic should i choose and what all should i include to make it look decent?

Member Avatar for sergent
0
215
Member Avatar for Gaiety

Hello , i have read the manual page of alloca , it is documented there that "alloca works similar to the malloc but it allocates memory from stack and frees automatically. i can't get how can i use that in a program . if i'm not wrong can i use …

Member Avatar for monishch
0
183
Member Avatar for NV43

Below I have attached my code. The problem I am having is that I do not think it is properly computing the sum. It seems as if its missing a number or something along those lines. The program is supposed to read an input number, n, which must be a …

Member Avatar for nezachem
0
166
Member Avatar for busyaish

Hi all, In c,i want to split string into array. Example: char *string="abcdefgh"; into char arrays like 'ab','cd','ef','gh'. Any suggestions or ideas are welcome...

Member Avatar for WaltP
0
144
Member Avatar for guidely

HI how can store multiple array into one array [CODE] int id[5] = { 1,2,3,4,5,6}; int size[5] = {35,76,85,78}; int PerBox[5] = {12,24,44,54}; double Price[5] = {3.32,6.76, 13.45,6.08,7.8}; int item[200],i; for(i=0;i<4;i++) { item[i] = {id, size, PerBox, Price}; } [/CODE] each element should store id, size, perbox, price and output: …

Member Avatar for cse.avinash
0
251
Member Avatar for Uni

From a text file, i should get the necessary information in order to create a beat map, a representation of what we see in music sheets, from this text file: [CODE]3 measures 3 4 time signature 4 beats 4 note, measure 1 3 note, measure 1 1R rest, measure 1 …

Member Avatar for YAMNA MIDHAT
0
173
Member Avatar for Uni

I am supposed to read a text file containing "lyrics", then format it out based on special symbols like +,-,[] and spaces. Here's the lyrics syntax: [B]Spaces are significant:[/B] A single space between two words makes the two words go in two successive beats. Each additional space causes the lyric …

Member Avatar for Uni
0
126
Member Avatar for guidely

Hi, Am very very struct is there possible way to multiple variable into one element in array c and is there posible to do case statement with array. What I try to if max capacity of ship is less than max capacity of harbour but I need to check every …

Member Avatar for guidely
0
411
Member Avatar for yakovm

I have the following code example (in windows): [CODE] int fd = _dup(fileno(stdout)); freopen("tmp","w",stdout); printf("1111"); close(stdout); char buf[100]; FILE *fp; fp = fopen("tmp","r");//in this line fd turns to be 0 if(NULL == fp) return -1; fgets(buf,100 , fp) != NULL ); fclose(fp); [/CODE] I need the value of fd for …

Member Avatar for D33wakar
0
141
Member Avatar for Curtisq

So my problem is writing a program that asks the user to input a number wich is stored with scanf then print the binary representation of that number in 32 bits, as in if the number is 1 i would need 31 0's and a 1. [CODE]#include <stdio.h> void dec_bin(long …

0
103
Member Avatar for Ich bin würdig

Can someone help me in building a syntax for this problem Write a program that accepts a positive integer and gives its prime factorization that expresses the integer as a product of primes. Here's one that I did: [CODE] #include<stdio.h> #include<conio.h> void main() int N,R; clrscr(); printf("Please enter a no.:\n"); …

Member Avatar for rubberman
0
235
Member Avatar for geeksforgeek

hello daniweb... i got my head struck with the code, and unable to understand the output.please help.. [CODE] int main(void) { float i=3.3; if(i < 3.3) printf("hy"); else printf("bye"); return 0; } [/CODE] output should by bye as 3.3 < 3.3 condition false , but why it is printing hy. …

Member Avatar for Narue
0
142
Member Avatar for Alvi89

This is a part of the code not working properly, i first converted an array integer (containing a binary value) to an integer and convert it into an octal value: here is the code: Note: this section of code does not give an output at all. [CODE]/**************************************** CONVERSION FROM DECIMAL …

Member Avatar for Panathinaikos22
0
102
Member Avatar for Tenjune

I'm testing this sample fast food chain program and my problem is every time I select the order the resulting price is like Php895764796364227741000000000000000.0000 Here's the code: [CODE] #include<stdio.h> main() { int choice; float TP; clrscr(); printf("Welcome to Greenwich!\n\n"); printf("This is our menu:\n"); printf("1. Overloaded Pizzas\n"); printf("2. Extreme Cheese Overload\n"); …

Member Avatar for YAMNA MIDHAT
0
113

The End.