15,551 Topics
| |
A console application to multiply two matrix of float numbers and print result on console. Some memory checks are done as it is allocating memory dynamicaly. May give error and exit when short of memory. | |
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. | |
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 … | |
How to write a tic tac toe game program in c language using int char array with the help of for & while loop | |
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 … | |
| 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 … |
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. | |
| 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) … |
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, … | |
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 … | |
[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] | |
[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) … | |
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 … | |
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 … | |
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? | |
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; … | |
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 … | |
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? | |
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 … | |
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 … | |
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... | |
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: … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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"); … | |
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. … | |
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 … |
The End.