519 Posted Topics

Member Avatar for nikc121

Your first post says that you have to use functions ... Do you know what functions are ? Post #5 contains the skeleton of a function in C++. This link gives you another example [url]http://www.cplusplus.com/doc/tutorial/functions/[/url] Now you want to move the part of code between line 22-24 in the function …

Member Avatar for WaltP
0
268
Member Avatar for PabloTeK

Dude you got to post some more code ..... What is the structure definition ? How exactly are you passing it ? How are you printing it ? (The complete statement ) Since I have absolutely no clue as to what exactly is your problem, here is a shot in …

Member Avatar for abhimanipal
0
79
Member Avatar for rai32

On line 51 why are you closing the server socket ? Should that not be like the last step of the program ?

Member Avatar for rai32
0
292
Member Avatar for M_SOLAIMAN
Member Avatar for ashwini_rt

I thick you can use fseek. But you have to know how many position you want to go from start/ end of file [url]http://www.cplusplus.com/reference/clibrary/cstdio/fseek/[/url]

Member Avatar for Ancient Dragon
0
236
Member Avatar for spdbump08

You have 2 return statements on line 46, 47. The one on line 47 will never get executed Similarly you have a return statement on line 52. So the code from line 53 onwards cannot execute

Member Avatar for WaltP
0
95
Member Avatar for pinsickle
Member Avatar for pinsickle
0
93
Member Avatar for tquiva

Look closely into you for loop. This is the statement that you have written [CODE] total += a[MAXVALS]; [/CODE] What this means is that you are adding the value stored in a[100] num times. Is this what you want to do ?

Member Avatar for jonsca
0
509
Member Avatar for tquiva

Quick question, what is the relevance of the pink rows and blue rows ? Also I am not sure I follow the explanation of the problem. Does it happen that when you display the grid the location of the mines are visible or are they hidden like the game minesweeper …

Member Avatar for Adak
0
3K
Member Avatar for koitfm

If you the format of the data then you can use the fscanf function If not use read to read the contents of the file into a char array and then implement a parser to parse the data

Member Avatar for jephthah
0
4K
Member Avatar for yushuan718

Maybe this is a stupid question but what will be the value of size when the entire page is read ? Wont it be 0. Cant you use that check to determine when the page is read ? Or am I missing some thing ?

Member Avatar for yushuan718
0
98
Member Avatar for dls_20022002

Quick question.... Are you storing the information about the books in a data structure or in a file ? The reason I ask is that you have a ofstream object in your delete file function

Member Avatar for abhimanipal
0
105
Member Avatar for e30rapidic

There are 2 -3 compile time errors in your code.. [QUOTE=e30rapidic;1204376] [CODE] #include<iostream> #include<vector> #include<iomanip> #include<string> using namespace std; class Person { private: string name; // Make this bestFriendName. You have used bestFriendName in the function definitions Person* bestFriend; int count; public: void setName(string n) { name = n; } …

Member Avatar for abhimanipal
0
730
Member Avatar for martinjcloud

Line 14 of your code is [CODE] (strings, n, sizeof(char *), compareStrings); [/CODE] What is the purpose of this line ? From what I have understood of your code I think you are taking the input correctly. One way to out put the words randomly would be to use the …

Member Avatar for jephthah
0
130
Member Avatar for Priyanka88

[QUOTE=Priyanka88;1205040]hello, i am student and i want to know more abour binary expression tree...i hav idea about creating binary search tree ....bt v r suposed to create binary expression tree....e.g..for a+b....+ (infix/prefix/postfix) / \ a b will u plz help me how to proceed??[/QUOTE] Check out this link .... Maybe …

Member Avatar for abhimanipal
0
129
Member Avatar for Stivdion
Re: C++

Dude the variable size is initialized to 0. You dont change its value any where in the program. Give it the value of string length at some point of the program

Member Avatar for Stivdion
0
83
Member Avatar for manutd4life
Member Avatar for abhimanipal
0
209
Member Avatar for am5a03

Probably some thing of this sort [CODE=C] void rev(int* arr, int lower, int upper) { if ( lower >= upper) return; // Swap the 2 values rev(arr, lower+1, upper-1); } [/CODE] Where lower and upper are the smallest and the largest indexes of the array

Member Avatar for am5a03
0
231
Member Avatar for Ni6tO_

Dude Where are your code tags I am reading your getCalendar date function to print the date in the proper manner, but just a quick question, cant you read the file line by line and into a char array and then use strtok with space as the separator ? From …

Member Avatar for Ni6tO_
0
165
Member Avatar for Lrob7325

Use code tags..... It makes it much easier for us to understand your code when you use code tags When I compiled your code, I get an error on this line if(Ranks[Deck[CardDrawCount] % 13] == 0 ) The reason for this is that this expression becomes (when CardDrawCount is equal …

Member Avatar for abhimanipal
0
145
Member Avatar for Wildfire760

@Banfa ... When you calculate new number of trucks and load per truck why will you get a different value ?

Member Avatar for Wildfire760
0
141
Member Avatar for crss

Check out this link .... Maybe of help [url]http://www.dreamincode.net/forums/topic/37428-converting-and-evaluating-infix-postfix-and-prefix-expressions-in-c/[/url]

Member Avatar for Fbody
0
256
Member Avatar for jdpjtp910

I dont think the logic used by you is correct . Check out the method shown in this link...... Its far more simpler as compared to your code [url]http://www.knowledgesutra.com/index.php/Data-Structures-Linked-List-Reverse_t52777.html[/url]

Member Avatar for abhimanipal
0
211
Member Avatar for YeMiller

Also for your program it would make sense to change the data type of choice to int as opposed to what you have now

Member Avatar for YeMiller
0
169
Member Avatar for serena5

If you are looking for a direction to get started at least .... Try making a text editor first which has the basic functionality like Notepad .... Once this is done (and you are still determined to move ahead) then you can think of more advance functionality

Member Avatar for jonsca
0
676
Member Avatar for 3cats
Member Avatar for zyx

Maybe this link will be of help ? [url]http://www.google.com/search?hl=en&q=birthday+paradox+c%2B%2B&sourceid=navclient-ff&rlz=1B3GGGL_enIN258IN259&ie=UTF-8&aq=1&oq=birthday+paradox+c[/url]

Member Avatar for Salem
0
154
Member Avatar for ranvi

I have written a simple example which shows how you can use the void pointer to pass an integer value. Maybe this will be of help [CODE] void func(void* p) { int *x= (int* )p; printf("%d\n",*x); } int main(int argc, char* argv[]) { int x=10; void* p= &x; func(p); cin.get(); …

Member Avatar for Salem
0
455
Member Avatar for scarypajamas

[CODE] struct Foo { char* value; }; // are a and b created in the data segment of the asm. The data is probably is the code segment struct Foo a = {"Hello from variable a"}; struct Foo b = {"Hello from variable b"}; int main() { // what will …

Member Avatar for scarypajamas
0
107
Member Avatar for rlhh

The method used by you to check if the num exists in that particular row or column is correct (though inefficient ) Checking if the number exists in that box is a bit tricky ..... You want some thing of this sort [CODE] // All the boxes are 3 * …

Member Avatar for Adak
0
169
Member Avatar for ans025

1. In the code that you have posted, you have defined the function read in the function main ..... Put the brackets properly 2. Check how you have called the read function. Is that the correct way to call a function 3. I would recommend changing the name of the …

Member Avatar for ans025
0
203
Member Avatar for d34dw4rd

The logic that I would use for this problem will be as follows : Input Array A[50]: Temp Array B[50] for(i=0;i<50;i++) B[i]= A[i] - target Sweep thru B and find the greatest -ve number and the smallest positive number . Let the indexes of these values be i1 and i2 …

Member Avatar for abhimanipal
0
133
Member Avatar for smoothe19

Could you post the part of the code where you read from the file and then call the function

Member Avatar for mitrmkar
0
5K
Member Avatar for ahmed hefnawy

You are passing both the array by value (syntax for this is also wrong). Change this to pass by pointer There are more serious bugs ... Will try to get back to you in some time on those

Member Avatar for abhimanipal
0
203
Member Avatar for mariosbikos

Google for srand You want some thing of this sort ... After you have got random numbers in i and j [CODE] if(i==j) { // Do nothing } else { // Execute the loop below } for(z=0;z<20;i++) { if( (map1[z]==i)&&(map2[z]==j)) { //Do nothing } else { // Insert into the …

Member Avatar for Adak
0
118
Member Avatar for MJaske

Check out this link ... [url]http://www.cplusplus.com/forum/beginner/7386/[/url] I think this should solve your problem ....

Member Avatar for MJaske
0
163
Member Avatar for simonsayz27

You can use the fscanf method. [CODE] int buf1[100]; fp1=fopen("data.in","r"); // Open the file containing data in the input mode if(fp1==NULL) { printf("%s","Could not open source data file"); // If the file cannot be opened the program exits exit(1); } else { while(!feof(fp1)) fscanf(fp1,"%d",&buf1[i++]); // Read the data into the …

Member Avatar for abhimanipal
0
140
Member Avatar for rlhh

There are many more mistakes in your code... 1. When you are accessing the matrix elements the for loops should be [CODE] for(i=0;i<3;i++) { for(j=0;j<3;j++) { // Do printing checking what ever } } [/CODE] 2. Initialize count to -1 3. When you are checking for repetition, you have to …

Member Avatar for abhimanipal
0
138
Member Avatar for fusi0n423

Check out this link [url]http://www.prasannatech.net/2008/07/socket-programming-tutorial.html[/url] In the example code of TCP Client, there is a line host = gethostbyname("127.0.0.1"); In place of 127.0.0.1 you can use the name of your server

Member Avatar for abhimanipal
0
164
Member Avatar for tcstom

[QUOTE=tcstom;1197081]I tried changing the code to: [code] void AddDevice(int Foo, unsigned int Bar); unsigned long* ptr2data; DWORD temp; *ptr2data = (unsigned long) SomeArrayOfData[4]; temp = (DWORD) ptr2data; AddDevice(7, temp); [/code] as suggested by Jephthah, and it didn't work :( The method suggested by Deeep wasn't very clear, I tried changing …

Member Avatar for tcstom
0
141
Member Avatar for mystb

[QUOTE=mystb;1196799]I think we finally have something. Because for small letters (like a b c) it works but for others (like u r k) it just gives -1943. I think this is because of data type. (which is int). u is 21 and 21^13 is really big number so i thought …

Member Avatar for mystb
0
299
Member Avatar for ilkeamasya

[CODE] char *letter; if(info[i].grade >= (mean + 1.5*stddvt)){ info[i].letter= "AA"; [/CODE] This code is wrong. When you say char* letter you just have a pointer. For storing data the pointer has to point to some memory. Check out the function malloc

Member Avatar for ilkeamasya
0
249
Member Avatar for Slobodino

I guess the terminating condition could be when all the fruits are un reachable( height wise) ....

Member Avatar for craig_ka
0
131
Member Avatar for smeghead007

Use this to read a file line by line [code=c++] char buf[20]; while(accountsinFile.getline(buf,20)) { cout<<buf<<endl; } [/code] After this you can parse the string in buf and store its contents in the data members of the struct

Member Avatar for abhimanipal
0
116
Member Avatar for patsfan

Also what are these functions qinit, qremove, qadd ?? Are you sure there are no errors in these functions ?

Member Avatar for abhimanipal
0
118
Member Avatar for smeghead007

[QUOTE=smeghead007;1161289]so should i put the file into an array ie num_array[500] and read the file into the array so i can access num[1] num[5] etc.. and sort them would getline put them in an array though[/QUOTE] Yes . But one point of caution. Make sure the size of the file …

Member Avatar for smeghead007
0
139
Member Avatar for Zephraph

Write the ndice function this way [code=c] int Ndice ( void ) { int nrolls = 0; while( /*loop infinitely */) { printf ("Please enter the numerical amount of dice you would like to roll (maximum 10):\n"); if(/*If the value entered is not correct */ { // Print the error …

Member Avatar for jephthah
0
78
Member Avatar for Xufyan

[QUOTE=Xufyan;1167124]Hey Thanks...and how to calculate remainder of [icode]a[/icode] and [icode]b[/icode] only if [icode]b[/icode] is one less than [icode]a[/icode] ?? i mean when the values of [icode]a[/icode] and [icode]b[/icode] are same then the remainder must not be calculated ?[/QUOTE] Put an if condition [code=c] if(/*check if b is less than a …

Member Avatar for Xufyan
0
167
Member Avatar for nickewus24

Get started with you HW Post your progress and a specific question If you just post the question that you got for an assignment without showing your efforts then you will be ignored

Member Avatar for nickewus24
0
147
Member Avatar for xavier666

[QUOTE=xavier666;1161918]I don't get this error. I mean if i try to free a NULL memory, it does not say anything. Hey! Look at line# 2 :P This was another one of my doubts. If i don't type caste calloc/malloc, my compiler is giving me errors. Take a look [CODE]# include …

Member Avatar for Banfa
0
653

The End.