1,494 Posted Topics
Re: 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] | |
Re: So what's the problem? Please give details. | |
Re: 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] ![]() | |
Re: [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 … | |
![]() | Re: 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 … ![]() |
Re: 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': … | |
Re: 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] | |
Re: If your getting syntax errors and stuff. Please post them. | |
Re: 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] | |
Re: 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] | |
Re: Try looking up the functions fork() and execlp(). | |
Re: [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 … | |
Re: 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 … | |
Re: I'm having problems figuring out what you mean. | |
Re: Sounds like homework...Is it? | |
Re: [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. | |
Re: I would look up GTK+ [url]http://www.gtk.org/[/url] [url]http://developer.gnome.org/gtk-tutorial/2.90/[/url] | |
Re: 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 … | |
Re: I always thought that the GCC(mingw) compiler accepted AT&T syntax for inline assembler. | |
Re: [QUOTE=zeroliken;1756175]try to include the header unistd.h[/QUOTE] What you think this is a Unix/Linux based system? | |
Re: Shouldn't you have a closing brace on line 32. | |
Re: 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 { … | |
| |
Re: 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 … | |
Re: Depends, what is the criteria for discarding characters. | |
Re: QDialogButtonBox::Ok looks like an enum value defined in QDialogButtonBox class. | |
Re: Maybe you should try: [code] repeat1 = true;//assignment while ( repeat1 == true )//equals {} [/code] | |
Re: Sure we'll help fast as soon as you post what you have fast. | |
Re: Try looking at it like this: [code] printf("%s",p + (p[3] - p[1])); [/code] or like this: [code] printf("%s",&p[4]); [/code] | |
Re: 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"; } | |
Re: Can we see an example of the string? | |
Re: 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 … | |
Re: Probably the easiest way is to include a boolean field with your objects 'previous state' and set and retrieve previous states from it. | |
Re: 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] | |
Re: 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. | |
Re: I think it has to do with line 28 where your returning a DateTime..Try returning void. | |
Re: 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. | |
Re: You could use an arbitrarily large number library. [url]http://gmplib.org/[/url] | |
| |
Re: 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? | |
Re: [code] string some_function() { ..... return resultstring1; } [/code] | |
Re: You should be able to subtract the base address of the array from the return value from bsearch. | |
Re: This [code] case 17; [/code] should be [code] case 17://note its a colon [/code] | |
Re: [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 … | |
Re: I'm pretty sure that mmap() is for POSIX systems. [url]http://en.wikipedia.org/wiki/Mmap[/url] | |
Re: I see one major problem here [code] int x; scanf("%lf", &x); [/code] Your treating x like its a float. | |
|
The End.