1,494 Posted Topics

Member Avatar for Graphix

Could you post the results of running this code. [code] #include <stdio.h> int main() { int x; fprintf(stdout, "size->%lu\n", sizeof(void*)); fprintf(stdout, "size->%lu\n", sizeof(int)); fprintf(stdout, "size->%p\n", (void*)&x); fprintf(stdout, "size->%d\n", (int)&x); return 0; } [/code]

Member Avatar for Graphix
0
174
Member Avatar for mweshk
Member Avatar for Sommy

Try changing this line [code] scanf("%d %d %d",a,b,c); [/code] to [code] scanf("%d %d %d",&a,&b,&c); [/code] A few more pointers.. main should return an integer [code] int main() { ... return 0; } [/code] and you should include the library math.h for the math function(s). [code] #include <stdio.h> #include <math.h> [/code]

Member Avatar for MonsieurPointer
0
211
Member Avatar for qualt

[QUOTE=qualt;1762729]The .exe file doesn't executes effectively in other computers which doesn't have TC installed, although it works fine graphically in my PC and it's because i've TC installed. Keeping it short and simple "Is there any way to embedded the standard obj and lib files into the the exe file …

Member Avatar for qualt
0
347
Member Avatar for thache

First off your missing two includes [code] #include <stdlib.h> #include <string.h> [/code] Also this function [code] void add(char *firstName, char *lastName, int *exam) { struct node *newnode = malloc(sizeof(struct node)); newnode->firstName = firstName;//must use strcpy(newnode->firstName, firstname) newnode->lastName = lastName;//must use strcpy(newnode->lastName, lastName) newnode->exam = exam;//actually not sure what your doing …

Member Avatar for thache
0
342
Member Avatar for personathome

For your first function try something like below: [code] int toNumber(char c) { switch (c) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': …

Member Avatar for Bench
0
235
Member Avatar for MochiAnjali

Well its really simple [code] struct student { std::string name; double midterm, final; std::vector<double> assignments; }; int main() { struct student a_student; a_student.assignments.push_back(value); return 0; } [/code]

Member Avatar for subith86
0
218
Member Avatar for broodwich
Member Avatar for crunchie
0
164
Member Avatar for Gilbert_1990

Do you mean your trying to create a new function that generates pseudo-random integers? I hope your not trying to pass something to rand(). [code] int rand(void); [/code]

Member Avatar for gerard4143
0
73
Member Avatar for ProgrammingGeek

Try something like this [code] #include <iostream> class test { public: int* num; }; int main() { test *d = new test; d->num = new int; *(d->num) = 3; std::cout << *(d->num); } [/code]

Member Avatar for ProgrammingGeek
0
139
Member Avatar for mikeshadow
Member Avatar for Graphix

[QUOTE=Graphix;1758969] It works fine for regular formatted files such as WORD-documents and text files, but with movies it stops after about 705 bytes, although the file is 42MB. I think it's because there is a EOF character in the middle of the file which breaks up the while loop. Does …

Member Avatar for Graphix
0
2K
Member Avatar for radiat

That's a new one 'enum operator'. What's that? Do you mean something like below? [code] #include <iostream> enum colour {red, green, blue}; std::ostream& operator <<(std::ostream & out, const colour & c) { switch (c) { case red: return out << "red"; case green: return out << "green"; case blue: return …

Member Avatar for Ab000dy_85
0
186
Member Avatar for Labdabeta
Member Avatar for C++ programmer
Member Avatar for mithunp
Member Avatar for stevanity

[QUOTE=stevanity;1757809]OMg omg! I found the solution... I should use g++ instead of gcc.. hehe Thanks anyway :)[/QUOTE] Yeah that would do it. Did it myself from time to time.

Member Avatar for gerard4143
0
200
Member Avatar for rushikesh jadha

I would look up GTK+ [url]http://www.gtk.org/[/url] [url]http://developer.gnome.org/gtk-tutorial/2.90/[/url]

Member Avatar for jbennet
0
126
Member Avatar for shean1488

I tried looking at your program but had some problems [code] #include<stdio.h> #define SIZE 100 int getline(char line[], int lim) { int c,i; for( i = 0; i < (lim - 1) && (c=getchar()) != '\0'; ++i)/*characters are surrouned by single quotes*/ line[i] = c; if(c == '\n')/*characters are surrouned …

Member Avatar for savoie
0
247
Member Avatar for Labdabeta

I always thought that the GCC(mingw) compiler accepted AT&T syntax for inline assembler.

Member Avatar for gerard4143
0
1K
Member Avatar for jaymayne

[QUOTE=zeroliken;1756175]try to include the header unistd.h[/QUOTE] What you think this is a Unix/Linux based system?

Member Avatar for jaymayne
0
461
Member Avatar for Reclaimer0418
Member Avatar for kspecks

Your constructor assume an integral type with its initializer [code] Array(unsigned arraySize): data(0), size(arraySize)//should be data(). size(arraySize) [/code] Oops, too early. I didn't see that data was a pointer. My bad, please disregard. This member function, why you returning T()? Shouldn't it be NULL. [code] T getValue(unsigned index) const { …

Member Avatar for VBNick
0
316
Member Avatar for zekstein
Member Avatar for thines01
0
108
Member Avatar for Breakbones90

Take a look at this function call [code] curve = Curve(info, i); [/code] Your passing i = 0 and what do you think will happen in this function when n = 0? [code] int Curve(Grades g[], int n) { int avg, curve, i, data; int sum = 0; int count …

Member Avatar for gerard4143
0
370
Member Avatar for swissknife007
Member Avatar for C++ programmer

QDialogButtonBox::Ok looks like an enum value defined in QDialogButtonBox class.

Member Avatar for Eagletalon
0
200
Member Avatar for passionated
Member Avatar for JilMakias
0
185
Member Avatar for Gonzo14

Maybe you should try: [code] repeat1 = true;//assignment while ( repeat1 == true )//equals {} [/code]

Member Avatar for Gonzo14
0
164
Member Avatar for programmerb
Member Avatar for ram619

Try looking at it like this: [code] printf("%s",p + (p[3] - p[1])); [/code] or like this: [code] printf("%s",&p[4]); [/code]

Member Avatar for ram619
0
119
Member Avatar for vtskillz

a string in c/c++ is a array of characters so extract then like so #include <iostream> int main(int argc, char**argv) { char *insert = "abcdefg"; for (int i = 0; i < 7; ++i) std::cout<<insert<<"\n"; }

Member Avatar for arunsolo1984
0
5K
Member Avatar for KazenoZ
Member Avatar for Tom_Weston

Try googling C++ string or check this link [url]http://www.cplusplus.com/reference/string/string/erase/[/url] Here's an example [code] #include <iostream> #include <string> #include <iterator> int main(int argc, char**argv) { std::string str("This is the string to work with"); std::cout << str << std::endl; std::string::iterator begin = str.begin(); std::string::iterator end = str.begin() + 8; str.erase(begin, end); std::cout …

Member Avatar for Xaviorin
0
380
Member Avatar for Tortura

Probably the easiest way is to include a boolean field with your objects 'previous state' and set and retrieve previous states from it.

Member Avatar for Tortura
0
174
Member Avatar for abshah

I would use a external data representation library(XDR). [url]http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.progcomm%2Fdoc%2Fprogcomc%2Fxdr_ovw.htm[/url]

Member Avatar for abshah
0
480
Member Avatar for achava

When the function 'funcko' returns the pointer to cat becomes invalid because the program releases its memory. Maybe releases is a bad way of putting it, the program makes the memory available for other uses.

Member Avatar for Narue
0
148
Member Avatar for superjj

I think it has to do with line 28 where your returning a DateTime..Try returning void.

Member Avatar for superjj
0
197
Member Avatar for ooops.789

Line 62 in your server program... [code] printf("\n connection established with the client %s",their_addr); [/code] their_addr is not a c-string. Line 56 [code] if(accept(sockfd,(struct sockaddr *)&their_addr,(socklen_t*)&sin_size)==-1) [/code] the accept function returns a socket descriptor which should be saved and used as a client.

Member Avatar for ooops.789
0
3K
Member Avatar for vishwanath.m

You could use an arbitrarily large number library. [url]http://gmplib.org/[/url]

Member Avatar for StuXYZ
0
205
Member Avatar for mccarthy.den
Member Avatar for WaltP
0
135
Member Avatar for Vasthor

You should try something like this. [code] int x = 0; std::cout << x++ << std::endl; int y = 0; std::cout << ++y << std::endl; [/code] What's the result?

Member Avatar for Vasthor
0
151
Member Avatar for SteveyD
Member Avatar for geeksforgeek

You should be able to subtract the base address of the array from the return value from bsearch.

Member Avatar for gerard4143
0
94
Member Avatar for Zarl

This [code] case 17; [/code] should be [code] case 17://note its a colon [/code]

Member Avatar for Zarl
0
297
Member Avatar for Mark198995

[QUOTE=Mark198995;1681144]hey me and my group are doing a project but we dont know how to use the file pointer (to export the C program to a text file and we dont know how to make it so the random generator makes our words go diagonal top left bottom left top …

Member Avatar for Mark198995
0
139
Member Avatar for ndayala

I'm pretty sure that mmap() is for POSIX systems. [url]http://en.wikipedia.org/wiki/Mmap[/url]

Member Avatar for gerard4143
0
565
Member Avatar for MrNo

I see one major problem here [code] int x; scanf("%lf", &x); [/code] Your treating x like its a float.

Member Avatar for MrNo
0
128
Member Avatar for n0de
Member Avatar for ronak127

The End.