- Strength to Increase Rep
- +5
- Strength to Decrease Rep
- -1
- Upvotes Received
- 3
- Posts with Upvotes
- 3
- Upvoting Members
- 3
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Hi there, I tried binary addition. It seems to work fine. Could someone tell me if there's a better way of doin this or any bugs that could be uncovered in the code below? I appreciate your time. Thanks, Tina [code=c] #include <stdio.h> void binaryAdd(char *, char *); int main() … |
|
This is dumb and I've been banging my head against it for the better part of the day, so perhaps someone here could help me see the light I keep missing. Let's say I have a string of 0/1's (or heads of tails coins, or yes or nos etc) For … |
|
hi I need help with this problem. I have tried writting the program, i just can not get it to run properly. Please Write The Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, ... begins with the terms 0 and 1 and has the property that each … |
|
Sorry guys, I know I should be thinking about this myself but after having all my seven proposals rejected:sad: , I have resorted to daniweb. Please give some ideas for a good thesis topic. If possible, please suggest something with some educational or business potential.:cool: |
|
I'm having difficulties understanding and printing the max value of a size_t type. Apparantly the size_t is typedefed to a unsigned long int on my system. Is this safe to assume its the same on all c++ compilers? The 'sizeof' function returns the number of bytes(size char), used to represent … |
|
I have been searching my texts, the web, and DaniWeb for information about how to share data between compiled C++ executables. I've been studying extern variables and named pipes without success. A typical program calls another program like this: float Pi = 3.14; system("AdjustSeaLevel.exe Pi 5.4 11.2 c f g"); … |
|
Hello, When i run my program it shows just segmentation fault. As my knowledge, segmentation fault can occur for pointer and memory related fault. But i could not find out my mistake. Please see some part of code(maybe, that is related to segmentation fault): [CODE] char *state_in; //state_in = malloc(1024); … |
|
Hi, Can someone elaborate why the following (the if conditional) differs [CODE=c] int main(){ const char *filename = "test.txt"; int ifd; if((ifd=open(filename,O_RDONLY))<3) err(EX_NOINPUT, "%s", filename); fprintf(stderr,"ifd is:%d\n",ifd); off_t bytes_in = lseek(ifd, (off_t)(-4), SEEK_END); return 0; } [/CODE] vs [CODE=c] int main(){ const char *filename = "test.txt"; int ifd; if(ifd=open(filename,O_RDONLY)<3) err(EX_NOINPUT, … |
|
Hi I've found a strange problem on ubuntu64bit, that limits the data you are allowed to allocate on a 64bit platform using the c function 'read()' The following program wont allow to allocate more that 2.1gig memory. [CODE=c++] #include <stdio.h> #include <stdlib.h> #include <err.h> #include <fcntl.h> #include <sysexits.h> #include <unistd.h> … |
|
I've been programmin on and off for some time. But today I saw something I hadnt seen before Some thing like [CODE=c] void error OF((const char *msg)); void gz_compress OF((FILE *in, gzFile out)); #ifdef USE_MMAP int gz_compress_mmap OF((FILE *in, gzFile out)); #endif void gz_uncompress OF((gzFile in, FILE *out)); void file_compress … |
|
[CODE]int main(){ string array[][]=get_element(2,3); return 0; } string get_element(int numrow,int numcol){ string result_array[numrow][numcol]; for (int i=0;i<numrow;i++) { for (int j=0;j<numcol;j++) { result_array[i][j]=" "; } } return result_array; //ERROR is on this line } [/CODE] I get error: conversion from ‘std::string (*)[(((long unsigned int)(((long int)numcol) + -0x00000000000000001)) + 1)]’ to non-scalar … |
|
i've done a c program which involves creating and updating of files,i'd like to run my exe online,and moreover i want my files to be updated automatically after i work on that exe ,is there any way to do this.Plz Reply Soon.Thanks in advance..... |
|
i have so many functions in my program,what i want to do is, i want to return back to the main() but in somewhere middle of it!. should i use goto statements? i tried 'em,it gave some error! if i should use goto then please explain how to,thanks |
|
Now i have an array, P[8]={0,1,1,2,0,3,1,0} And i want to add 4 separate values to each element in the array,so if i was to lookup P[2] i can access its 4 values. I tried doing it by giving those standard values an array of itself and making each value get … |
|
Hi: How can I write a program using pointers and classes. My program suppose to translate dollar amounts in the range 0 through 9999 into an English description of the number. For example, the number 710 could be translated into the string seven hundred thirteen, and 8203 would be translated … |
|
i am doing bscs from GCU lahore PK.i have assigned a project name as MOVIE RENTAL STORE using OOP concepts plz help me to do my project i,ll b thankful to you, umair ahmad |
|
If I simply just want to tokenize the first element of a string and then output the remainder of the string, how can this be accomplished? thanks [CODE=c] #include <stdio.h> #include <string.h> int main(){ const char* line= "0 firstline"; char* l = strdup(line); printf("beforeToknization:\t%s\n",l); char *tok = strtok(l," "); printf("firstToken:%s\trestOfLine:%s\n",tok,l); … |
|
Hi I got a code that in pseudo dos something like [CODE] ifstream os; while(os.oef()){ os.getline(buffer,length); } [/CODE] If some condition is met, I'd like to be able to jump back to the previous line, such that the next getline will give the line just-read in, at a later time … |
|
The age old issue of string parsing comes up again ... I have a text file that contains lines that are SUPPOSED to follow a set format, specifically: string, string, long string int string double int The delimiters are therefore: Comma (,) for the first two fields Spaces for all … |
|
Hi, given a cstring, I need to extract the digits in it, the digits are prefixed with either a '+' or '-'. Like [CODE] ,.,.,.,+3ACT,.,.,.,.-12,.,.,.,.,.,.,.,actgncgt #OUTPUT 3 12 [/CODE] I've made a working program that does what I want, but it seems overly complicated. Does anyone have an idea if … |
|
hello guys i recieve errors when compiling my code [code] #include <iostream> #include <fstream> #include <string> int main() { std::string firstname, lastname, age, emailadress, message; char answer; std::cout << "Hello please imput your first name: "; std::getline(std::cin, firstname); std::cout << "\nNow please enter your last name: "; std::getline(std::cin, lastname); std::cout … |
|
Hi, I have 3 seperate make file where, 1st one generates a static library libCanOpen.a, (using ""ar -r ") 2nd one creates a dynamically linkable library libPixyCANopen.so (using "g++ -Wall -fPIC -shared") and the 3rd one creates the executable by linking it to libPixyCANopen.so. The 1st two makefiles build without … |
|
Hi Every Body I am new born in C++ I am facing and error for last 3 days I tried my best with all what I knew but FAILED..... Error is - " Linker Error: Undefined Symbol Library::code in module PRGDONE.CPP" I am using Turbo C++ 3.0 of Borland Here … |
|
Hi All, Does anyone know which file manipulation library is faster between c's FILE and c++'s fstream? I would suppose that c++'s fstream would be the faster but I just wanted to see some expert advice/opinion on this. I googled the internet without finding anything concrete. If there is any … |
|
Hi I'm having a very basic newbie problem, The compiler forces me to do a strdup (because of cons correctness), can I void the extra line in my code, and then I cant seem to update my array after the funciton call [CODE=c++] void fix_name(char *name){ if(name[strlen(name)-1]!='/'){ char *tmp = … |
|
i need to make a program that finds all primes between some numbers the biggest number is 1000000000. the code that i have works fine, the only problem is that what i thought that would solve this, is too slow [code] #include <stdio.h> int main(){ FILE *fin=fopen("in.txt","r"); int t,n1[10],n2[10],i,j,ex,k; fscanf(fin,"%d\n",&t); … |
|
Hi, can anyone tell me why i can't clean up the memory, and maybe a small solution. I'm allocing memory with strdup for each key, but I cant figure out how to erase the key with free. Before anyone starts talking about mixing c++ and c, I know it's generally … |
|
Hi, [LIST=1] [*]Question Why does valgrind complain? [CODE] Conditional jump or move depends on uninitialised value(s) ==25636== at 0x4C26D29: strlen (mc_replace_strmem.c:242) ==25636== by 0x40060A: main (test.c:7) [/CODE] [*]Question Strlen doesnt apparantly tell you how much space you have in your array, but the number of chars til '\0'. I my … |
|
Hi I stumpled upon some c-code, which syntactically is different from what I've seen before. [LIST=1] [*]first [CODE=c] void strreverse(char* begin, char* end) { char aux; while(end>begin) aux=*end, *end--=*begin, *begin++=aux; } [/CODE] Would this be the same as [CODE=c] void strreverse(char* begin, char* end) { char aux; while(end>begin){ aux=*end; *end--=*begin; … |
|
I hate to be spamming the forums with this, but I've been banging my head at the wall for a few hours now, and I can't really understand what is going on. Here's the full program I'm running: [code=c++] #include <iostream> #include "math.h" int main() { std::cout << sin (3.141592653589793) … |