257 Posted Topics

Member Avatar for icasta13

i think the error is the missing [B];[/B] at the end of the class declaration in the header file. [CODE]class Prog { public: void ReadList(int Array[], int N); void Avgs (int Array[], int N, int &Ave, int &aveP, int &AveN); int Large (int Array[], int N); void Display(int Array[], int …

Member Avatar for jonsca
0
220
Member Avatar for mg120

>>Then I want to make graphics, ı mean ı want to show moves in Chess Board , are there any source code of this ? Well, there are many Graphic libraries available. Question is, how good do you want them to look? Do you want the Chess pieces to be …

Member Avatar for msaqib
0
225
Member Avatar for bojomojo

Declare a structure as follows: [CODE] struct read_file { char name[100]; int age; } var; fscanf(fp, "%d = %s", &(var.age), var.name); [/CODE]

Member Avatar for bojomojo
-1
146
Member Avatar for Mona..

Well, you can try this: 1) Check if it is an Uppercase letter.(Using the ASCII value) 2) If it is, add 32 to it.(convert it to lower case) [URL="http://www.asciitable.com/"]Ascii Table[/URL]

Member Avatar for Narue
0
204
Member Avatar for gahhon

Paste the code, of whatever you have tried. We can help you build on that. Well, here is a hint: Let the number be N rev_num = rev_num * 10 + (N % 10) N /= 10 You need to do this till N becomes 0.

Member Avatar for myk45
0
197
Member Avatar for FutureWebDev

>>If each number entered by the user is 3.7E+38 / 10, then the average of those ten numbers should never exceed 3.7E+38 correct? Yes, it is correct. Could you elaborate a little more? What problem are you facing?

Member Avatar for FutureWebDev
0
187
Member Avatar for benny2010
Member Avatar for bookmark
Member Avatar for johngalt10

Well, you can't use cout to do that. You will have to use other libraries. Here is one: [url]http://qt.nokia.com/products/[/url]

Member Avatar for jonsca
0
100
Member Avatar for Joey_Brown

Well, the function is basically allocating memory to a bunch of pointers. It can be shown like this: [CODE] [....] means allocate memory to a pointer. ptr1 = [.....] ptr2 = [.....] ptr3 = [.....] ptr4 = [.....] This is done by for(i=MIN;i<row;i++) { arr[i]=malloc(col*sizeof*arr); if(!arr) { printf("\nMemory unavailable"); exit(EXIT_FAILURE); …

Member Avatar for Trentacle
0
151
Member Avatar for MacImg

It depends what type of image you want to read. Reading a bmp file is pretty simple. [URL="http://en.wikipedia.org/wiki/BMP_file_format"]Here[/URL] is the bmp format.

Member Avatar for myk45
0
85
Member Avatar for alexchen

@OP Is this what you mean? Use a visited[] array to mark the ones that have already been generated. [CODE]int visited[100]; // to mark visited ones. Let all of the values be 0 initially. int count = 0; // Now, lets try to store 10 unique numbers between 0-99 while …

Member Avatar for ravenous
0
18K
Member Avatar for alexchen

Well, you can try this: 1) Count the number of lines in the file 2) Do this: [CODE] rand_no = rand() % count; // where count is the no. of lines in the line.[/CODE] 3) Now, use a loop to iterate to that line. PS:[URL="http://www.cplusplus.com/reference/clibrary/cstdlib/rand/"]rand()[/URL]

Member Avatar for alexchen
0
1K
Member Avatar for lmytilin

Well, you can try this method: This involves extra space though. Algorithm: 1) Extract words into a buffer( i have used a 2D array) 2) Mark indices 3) Swap indices. 4) Print as per indices, so that the words will be swapped. [CODE] char *arr = "hello world bye world"; …

Member Avatar for myk45
0
2K
Member Avatar for SoulReaper1680

Well, i guess you can use threads. But you might have to make sure you make them synchronized. i have never tried doing it, but i guess you can, using threads.

Member Avatar for SoulReaper1680
0
175
Member Avatar for natha_peepli

[CODE] #include <stdio.h> void value(int *Matrix,int a, int b); int main(void) { int Row1 = 0, Col1 = 0, Row2 = 0, Col2 = 0; int Matrix1[10][10]; // Here. int Matrix2[10][10]; printf("This is matrix multiplication program"); printf("\nEnter the dimensions of two array "); scanf("%d %d %d %d", &Row1, &Col1, &Row2, …

Member Avatar for myk45
0
246
Member Avatar for becka221

[CODE]printf(" a . b = %4.1f\n", dot(a, b));[/CODE] Did you miss this out? i checked the output. i got 1.0 for c.b. That is correct right?

Member Avatar for becka221
0
103
Member Avatar for 07tr0wa07

Well, you can try 2 things: 1) Ask the user for how many products he wants. 2) Let entering -1 for a product be the end of the product list. ie: 1) [CODE] while ( salesPerson != -1 ) { cout << "Enter the number of products"; cin >> productCount; …

Member Avatar for 07tr0wa07
0
179
Member Avatar for techie929

OK, you can try this: 1) Reverse the string 2) Reverse each word in it eg: Hello World 1) dlroW olleH --> i guess you have done this part. Now, reverse each word in it For this, try this: [CODE]for (i = 0 to length(string)) { while (string[pos] != SPACE) …

Member Avatar for gerard4143
0
135
Member Avatar for zartasha*

Could you elaborate a little more? >> in which even no.s print Do you mean you want to print the even numbers in the array? Also, paste the code you have already written.

Member Avatar for jonsca
0
69
Member Avatar for danyesu86

@OP You could try using scanf() in this way: [CODE] /* enter eqation */ scanf("%dx %c %dx %c %d", &v1, &v2, &v3) ;[/CODE] eg: 1x + 2x - 3 But in this case, you cannot give -x in the beginning as in your example, you will need to enter 1x. …

Member Avatar for myk45
0
104
Member Avatar for pato wlmc

Well you can use Qt. [url]http://qt.nokia.com/products/[/url] You can configure VS for Qt. If it is just a single push button, i suggest you create a small rectangular box with a label on it that says "Press" or something like that. i mean would you like to use an entire framework/library …

Member Avatar for myk45
0
3K
Member Avatar for myk45

Hello, im trying to implement a generic double linked list, and i have added just one function(insert). But im getting some errors. Here is the code: [CODE]#include <iostream> #include <cstdio> #include <string> using namespace std; template <typename T> class doubleList { private: struct Node { T info; Node *leftPtr; Node …

Member Avatar for griswolf
0
160
Member Avatar for pato wlmc

>>I've tried to Link both of them on Visual studio and Code::Blocks with no succes. Both libraries you mentioned are pretty good. i have tried using ARToolKit (not on my machine, my friend's machine, on VS 2010) and there was no problem. Could you elaborate what exactly is the problem?

Member Avatar for myk45
0
308
Member Avatar for TrueCoding

There you go: i have written where i made the change [CODE]# include <stdio.h> # define MAX 100 int main(void) { int array[MAX],i,n; //printf("\n Enter Array Size: ",MAX); scanf("%d", &n); //Allows user to choose Array Size for(i = 0; i < n; i++) { printf("\n Enter %d value: ",i+1); scanf("\n%d", …

Member Avatar for Adak
0
109
Member Avatar for kapilsolanki84

Refer Programming Windows by Charles Petzold. An excellent book, and it also has a lot of examples. In fact, there is a sample code too, for drawing text in a Window. i haven't done much Windows programming myself, but i just referred the book. You can use [B]DrawText()[/B] function.

Member Avatar for WolfPack
0
217
Member Avatar for hadoque

Adding to what MosaicFuneral has suggested, you can try this, if this is what you are looking for [CODE] float val = 2.0; // make an unsigned char pointer point to the beginning, then extract all bytes unsigned char *ptr = (unsigned char *)&val; // first byte unsigned char p …

Member Avatar for hadoque
0
170
Member Avatar for enchuk

OK, from what i understand, you basically need 5 recursive functions: 1) This returns the count. [CODE]compute_digits_count(num) { if (num equals 0) return 0; return 1 + compute_digits_count(num / 10) }[/CODE] 2) The above code finds the number of digits. For the sum, this hint would be enough: Hint: Digits …

Member Avatar for enchuk
0
113
Member Avatar for Tiancailee

[CODE]float orientation;[/CODE] So, orientation is a floating point variable. So, how come this : [CODE]orientation.x[/CODE] Or, did you intend it to be [CODE]rot.x[/CODE] instead?

Member Avatar for Tiancailee
0
135
Member Avatar for kdcorp87

Could you paste the code here? Also, i guess you are referring to VS 6.0 . [URL="http://en.wikipedia.org/wiki/Visual_C%2B%2B"]These[/URL] are the versions of VC++. Are you using VC++ 6.0?

Member Avatar for Fbody
0
409
Member Avatar for hq1

Where are you looping through the matrix and checking if it is a magic square? [CODE]// calculate sum of 1st row for (i = 0 to cols) { sum += mat[0][i]; } // now check if all other rows and cols sum upto the same for (i = 1 to …

Member Avatar for jonsca
0
3K
Member Avatar for gizmo7008

Check [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]This [/URL]out. Is that is what you're looking for?

Member Avatar for gizmo7008
0
85
Member Avatar for sh4rif

Ok, you can use a recursive method for this. 1) Write a function to print each row, i.e say row number 3 is: 1 2 3 2 1 The function to do this can be done like this: Let max be a global variable, indicating the maximum number of each …

Member Avatar for myk45
0
106
Member Avatar for AlonsoPL

Well, since you mentioned array, you can try this: int num2[10], num1; /* Input num1 here */ ..... /* Multiplication part */ for(cont = i - 1, n = 0; cont >= 0; cont--, n++) { res = res + ( (num1 * num2[cont]) * pow(10, n) ); } This …

Member Avatar for myk45
0
153
Member Avatar for fg_aa_c

In the first case, i think the problem is with this: sizeof("\n") = 2. not 1 because, "\n" is a string, and is terminated by a "\0". [CODE]write(fd, "\n", 1);[/CODE] has to be [CODE]write(fd, "\n", 2);[/CODE] i think this might fix it.

Member Avatar for Madawar
0
127
Member Avatar for dubery

@dubery Hope this helps: [CODE] int a[10]; /* array to hold the numbers of the permutation */ void perm(int level) { int i; if (level == 3) { print the array } else { for (i = 0; i < 3; i++) { a[level] = i; perm(level + 1); } …

Member Avatar for dvillase
0
117
Member Avatar for oksbwn

Hmm, Qt is really good. But since you are asking for C, Gtk would be a good choice [url]http://www.gtk.org/[/url] PS: These are libraries or frameworks, not compilers.

Member Avatar for Ancient Dragon
0
162
Member Avatar for sing1006

What are you trying to do? The x is incremented. But you are not using it anywhere. It would help if you explain what you are trying to do.

Member Avatar for sing1006
0
123
Member Avatar for sing1006

The conversion formula is: C = (F - 32) * (5 / 9) and F = (C * 9 / 5) + 32 So, [CODE]for (x=0; x <= 100; x++) { printf("%d %d", x, CF(x)); } int CF(int C) { /* calculate the formula here and return the needed value. …

Member Avatar for sing1006
0
337
Member Avatar for Chocolatemoon

i have marked the places where i have made changes:- [CODE] #include <stdafx.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main( void ) { char text[ 3 ][ 100 ]; char search; char *searchPtr; int count = 0; int i; int k; printf( "Enter two lines of text:\n"); for ( …

Member Avatar for Chocolatemoon
0
121
Member Avatar for MarounMaroun

According to what i understood, you have a huge cube and you need to initialise the smaller cubes inside it, with their (x, y, z). Am i right? A more elaborate explanation would be helpful.

Member Avatar for myk45
0
109
Member Avatar for Transcendent

@OP Adding to the above suggestion, 1)Fundamentals of Data Structures in C++ by Ellis Horowitz , Sartaj Sahni, Dinesh Mehta 2)Data Structures Using C by Aaron M. Tenenbaum im not sure about the first book, the second one is pretty good.

Member Avatar for Ancient Dragon
0
305
Member Avatar for MarounMaroun

>>1. why we needed **p in the function AllocString? The function is receiving an address of a pointer. What is a pointer? It holds the address of a variable. So, say you have [CODE]int i; int *ptr = &i; /* Pointer to an integer */ int **ptr1 = &ptr; /* …

Member Avatar for MarounMaroun
0
106
Member Avatar for mmavipc

You might want to try this: [URL="http://msdn.microsoft.com/en-us/library/dd743680%28VS.85%29.aspx"]http://msdn.microsoft.com/en-us/library/dd743680%28VS.85%29.aspx[/URL]

Member Avatar for mmavipc
0
89
Member Avatar for myk45

Hello, i needed suggestions regarding the book "Art of Computer Programming" by Donald E Knuth. im an undergraduate Computer Science student. i would like to know more about the book before i buy it. So, any reviews? Reviews as to how the Math in it is(i heard there are a …

Member Avatar for myk45
0
109
Member Avatar for berwick53

[CODE] #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <time.h> int main() { char array1[][10]= {"sam", "ben", "sally", "molly", "jake", "samuel", "table", "chair", "computer", "mouse"}; char answer; char input; int r1=0; int r2=0; int length=0; int loop=0; int loop2=0; int score=0; srand (time(NULL)); for (loop=0;loop!=10;loop++) { r1 = rand() …

Member Avatar for myk45
0
144
Member Avatar for Ahmed Sarwat

im guessing the input file what you are using has the numbers not separated from each other. This was the contents of the file when i executed: 10.0 20.0 This works fine, so i guess the problem was, you had not separated by spaces.

Member Avatar for Ahmed Sarwat
0
3K
Member Avatar for superjj

Ok, all you need is the use of a graphic library(i would suggest OpenGL) to render the pixels. [url]http://www.talisman.org/opengl-1.1/Reference/glDrawPixels.html[/url] All you need is to render these pixels after reading it into a buffer. [CODE] fread(buff, 1, 800 * 600 * 3, fp); // read into buffer (i assumed an 800 …

Member Avatar for myk45
0
241
Member Avatar for Jollyyy100

@OP >>"is it really getting saved in a text file and how can i view it?" Open the file :) Since you have not specified the path explicitly, it generally gets created in the same directory as the source file or sometimes the executable. Just open it and check it …

Member Avatar for Adak
0
181
Member Avatar for fakiha erum
Member Avatar for Nick Evan
0
159

The End.