1,494 Posted Topics

Member Avatar for Spider05

Well to print a row you would hold the row index constant and then vary the column from 0 - max_column...So to print a column you would hold a column constant and vary the row from 0 - row_max. For row 2, i varies from 0 - max_column my_arr[2][i] for …

Member Avatar for gerard4143
0
192
Member Avatar for Asheem

Put this line before the function player2 [code] int player1(void); [/code]

Member Avatar for gerard4143
0
2K
Member Avatar for anirudhruia

Try something like this [code] #include<stdio.h> int main() { int i = 0; char p[10][10]; printf("please enter 10 words\n"); for(i = 0; i < 10; i++) { fgets(&p[i][0], 10, stdin); printf("\n"); } for(i = 0; i < 10; i++) { printf("%s", &p[i][0]); printf("\n"); } return 0; } [/code] A few …

Member Avatar for vinayakgarg
0
102
Member Avatar for anirudhruia

you had an error in your structure declaration and a questionable variable. [code] #include<stdio.h> #include<stdio.h> typedef struct contact { char name[1][20];/*why do you have this*/ struct number { double num; }no; } myc; int main() { myc thec; thec.no.num = 1234; fprintf(stdout, "num->%f\n", thec.no.num); return 0; } [/code]

Member Avatar for anirudhruia
0
101
Member Avatar for vbx_wx

You really should use a library like XDR(external data representation) to pass data across a network. It'll ensure that the network byte order is maintained.

Member Avatar for gerard4143
0
144
Member Avatar for ben25x

Try this [code] MessageBox(NULL, L"Text", "Title", MB_OK | MB_ICONEXCLAMATION); [/code]

Member Avatar for Ancient Dragon
0
2K
Member Avatar for MasterGberry

Try this for Main line 13. [code] testHand[0].addCard(testDeck.dealCard()); [/code]

Member Avatar for MasterGberry
0
190
Member Avatar for MasterGberry

First, you'll have to create a < operator for your class and then you'll have to create a function that compares two objects of that class using the < operator and then call the sort algorithm sort(your_vector.begin(), your_vector.end(), sort_function); Here's a simple example [code] #include <iostream> #include <vector> #include <algorithm> …

Member Avatar for MasterGberry
0
101
Member Avatar for cufisa

Before you concern yourself with averages I would get your while loop working, as it is you read the last grade twice. Try changing your loop condition to something like... [code] while( fscanf(infile, "%d", &numA) != EOF) [/code]

Member Avatar for cufisa
0
1K
Member Avatar for Amaina

Yes to all your questions. C is a general purpose programming language.

Member Avatar for gerard4143
0
129
Member Avatar for pucivogel

Could you please clean up your posted code. Its almost impossible to read. Your problem, by the way [code] void getDerivative() (double [],int[]); [/code] should be [code] void getDerivative(double [],int[]); [/code]

Member Avatar for alaa sam
0
148
Member Avatar for fab2

Try something like below [code] #include<stdio.h> int main () { int id = 0; float value1 = 0; float value2 = 0; while(id<=3) { printf("Please enter the id number - 1 to 2 - to end\n"); scanf("%d",&id); switch(id) { case 1: value1 = 10 * 10; printf("Value1 is: %f\n",value1); break; …

Member Avatar for ravenous
0
93
Member Avatar for beejay321

I see a problem right away [code] char list[9][31]; char sorted[9][31]; //--------Main Program Body---------- cout << "****Alphebetical Sorting Program***"<<endl<<endl; cout<<"please enter 10 strings you wish to sort"<<endl; [/code] Your arrays are 9 X 31 and should be 10 X 31.

Member Avatar for peter_budo
0
2K
Member Avatar for ElegantElephant
Member Avatar for Madmark88

It could be 'appearing' to hang because the algorithm is very inefficient and its taking a long time to calculate the bigger perfect numbers. Let it run for a few hours.

Member Avatar for Madmark88
0
100
Member Avatar for amiroletter
Member Avatar for neuro

Try adding this [code] #include <iostream> #include <cmath> using namespace std; int main() { double root1, root2, a, b, c, root; cout << "Enter the coefficients a, b, c: "; cin >> a >> b >> c; root = sqrt (b*b - 4.0*a*c); root1 = .5*(root - b) / a; …

Member Avatar for neuro
0
179
Member Avatar for b1izzard

Firstly, on line 68 [code] newloc=malloc(sizeof(struct bstree *)); [/code] your allocating memory for the size of a pointer not the size of struct bstree..It should be [code] newloc=malloc(sizeof(struct bstree)); [/code]

Member Avatar for b1izzard
0
948
Member Avatar for lochnessmonster

I would try simplifying your code... [code] #include <stdio.h> #include <stdbool.h> #include <ctype.h> #include <string.h> bool isValidNum( char str[] ) { int i = 0; for (i = 0; i < strlen(str); ++i) { if (!isdigit(str[i])) return false; } return true; } int main() { char string[] = {'\0','\0','\0','\0','\0'}; printf("%d", …

Member Avatar for WaltP
0
383
Member Avatar for MasterGberry

I tried this and got 1311780402. [code] #include <stdio.h> union myu { unsigned int x; char ch[4]; }; int main() { union myu the_u; the_u.ch[0] = 50; the_u.ch[1] = 46; the_u.ch[2] = 48; the_u.ch[3] = 78; fprintf(stdout, "x->%u\n", the_u.x); return 0; } [/code]

Member Avatar for MasterGberry
0
205
Member Avatar for tiuwulf

Try doing it like below [code] #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct mystruct { int a; }mytype; mytype* createMytype(int x) { mytype *mt; mt = (mytype*)calloc(1, sizeof(mytype)); mt->a = x; return mt; } int foo(mytype** mt) { *mt = createMytype(6); return 0; } int bar(mytype** mt) { printf("%d\n", …

Member Avatar for tiuwulf
0
91
Member Avatar for lochnessmonster

Well first things first...This is C++ and not C, just look at your for statements and your includes.

Member Avatar for lochnessmonster
0
83
Member Avatar for .It.
Member Avatar for AmerJamil
Member Avatar for VernonDozier
0
128
Member Avatar for lochnessmonster

I don't know why people have such difficulties with pointers. A pointer is a variable, its just like an integer variable except the values are memory addresses and the language C allows dereferencing pointers to obtain the value that's pointed to. Simple right? Now your question. If you perform these …

Member Avatar for Trentacle
0
152
Member Avatar for gerard4143

I have a question about function precedence. How does the compiler decide which function to call in quasi ambiguous situations? Is it laid out in the standard or is it implementation dependent? If you look at the attached code you'll see I'm outputting the value contained by the myint object. …

Member Avatar for gerard4143
0
99
Member Avatar for lochnessmonster

No your data is safe. When you reassign pointer, its just gets the address of your string "weeeeeeeeeeeeeeeeeeeeeee". "hi" - has one address value. "weeeeeeeeeeeeeeeeeeeeeee" - is another address value.

Member Avatar for taylorg
0
79
Member Avatar for iwanttolearnc

I was playing with this a while ago...quite a while ago so I can't guarantee that any of this code will work.. Here's the code that I used. mywrap.c [code] #include <Python.h> extern int intlimit(int); extern int glblimit(int); extern void* intbase(unsigned long); extern void* glbbase(unsigned long); extern unsigned long myfunc(void*); …

Member Avatar for gerard4143
0
229
Member Avatar for BanKuZ

I think you want a conversion operator..I think? Try looking up this link and see if its what your after.. [url]http://www.devx.com/tips/Tip/12459[/url]

Member Avatar for BanKuZ
0
258
Member Avatar for tacker

Try changing your array to.. int test[2][2][2]; Try running this code below [code] #include <stdio.h> #include <stdlib.h> int test[1][1][1]; int test2[2][2][2]; int main() { fprintf(stdout, "array elements->%lu\n", sizeof(test)/sizeof(int)); fprintf(stdout, "array elements->%lu\n", sizeof(test2)/sizeof(int)); return 0; } [/code]

Member Avatar for tacker
0
236
Member Avatar for lochnessmonster

Here's what I would do in the for loop [code] pointer[0].health = some_value; pointer[0].armor = some_value; pointer[0].nextaddr = &pointer[1]; [/code] Instead of using the constants 0,1 for the array indexes, use variables that increment in the for loop. Also make sure you remember that the last node points to nothing(NULL).

Member Avatar for gerard4143
0
104
Member Avatar for tudorH

Can you show us how your calling insertHead()?...Ooops, its line 16 of the posted code. Your assigning struct node *n to newNode->data. Is newNode->data an int?

Member Avatar for tudorH
0
228
Member Avatar for gerard4143

Am I correct assuming that a reference to an object will not call the object's destructor when the reference goes out of scope? The code I attached supports my assumption but I'm not certain if its correct...Any comments? [code] #include <iostream> class myint { public: myint():itsvalue(0) {} myint(unsigned long val):itsvalue(val) …

Member Avatar for gerard4143
0
2K
Member Avatar for pooran.c

Google is your friend. [url]http://www.suite101.com/content/procedure--subroutine-or-function--a8208[/url]

Member Avatar for pooran.c
0
122
Member Avatar for DJSAN10
Member Avatar for Aequitas1

You should be able to call the destructor which should call delete of the variable that points to the next node.

Member Avatar for Aequitas1
0
4K
Member Avatar for marooh

This functionality exists as a language extension so it depends on which compiler your using...So which compiler are you using?

Member Avatar for marooh
0
110
Member Avatar for jordankaushik
Member Avatar for alexchen

Line 7 [code] int area = (p(p - a)(p - b)(p - c))/2; [/code] should probably be [code] int area = (p * (p - a) * (p - b) * (p - c))/2; [/code] also line 13 your calling [code] convert(); [/code] You haven't defined a function convert.

Member Avatar for alexchen
0
115
Member Avatar for shiny27
Member Avatar for Niai123

You define, on line 123 char line[50]; And then use fgets on line 139 fgets(line,20,file) Why? I tried compiling your program and received these two warnings In function ‘count’: 111: warning: control reaches end of non-void function In function ‘table’: 49: warning: control reaches end of non-void function Both functions, …

Member Avatar for Ancient Dragon
0
106
Member Avatar for MarounMaroun

You have to pass the memory location that contains the pointers to the cstrings. If you think about it, it makes sense. Here's a big hint. If you were to define your function like below void swap(char *a, char *b); What would happen when you call it? It would create …

Member Avatar for Narue
0
141
Member Avatar for muze

On line 6 ICommDlgBrowser3 : public ICommDlgBrowser2 Your compiler can't find a definition of ICommDlgBrowser2 Did you include the proper header file?

Member Avatar for raf35
0
341
Member Avatar for gerard4143

I have a simple question about objects and exception handling. What happens to an object after its thrown? Does the implementation take of cleaning up that object or should I be aware of any situations that may require extra care...I've read this from - Inside The C++ Object Model by …

Member Avatar for gerard4143
0
129
Member Avatar for asterix15

Because that's what the function does..Here's a quote from my help file "int putchar(int c); writes the character c, cast to an unsigned char, to stream"

Member Avatar for anirudh33
0
133
Member Avatar for moroccanplaya
Member Avatar for Narue
0
97
Member Avatar for zetologos

When you enter a character from the console you hit return as well so you really enter two characters..e.g Enter the character 'a' plus return yeilds 'a', '\n' Instead of using putchar() try using fprintf(stdout, "value->%d\n", t); fprintf(stdout, "value->%d\n", x); What values were displayed?

Member Avatar for Narue
0
135
Member Avatar for o0OPatriciaO0o

Well what's it supposed to do? Can you give us an example of how its failing? Oh by the way, don't use fflush(stdin) its behavior is undefined.

Member Avatar for o0OPatriciaO0o
0
242
Member Avatar for amir malik

I don't like that your realloc'ing ch1 and then incrementing the pointer ch1. To me this seems like a recipe for disaster

Member Avatar for amir malik
0
285
Member Avatar for TSims11

Try removing the () in if ((textBox1->Text == ("")) && so that its is if ((textBox1->Text == "") && Actually on further inspection, you have on line 3 (radioButton3->Checked = false) it should be (radioButton3->Checked == false)

Member Avatar for TSims11
0
108

The End.