519 Posted Topics

Member Avatar for cpp.coder37
Member Avatar for mjmythili

One solution could be you could insert a '\0' /-1/some other invalid value after you are done inserting the numbers. Then in the function you can loop till you hit that invalid value

Member Avatar for Ancient Dragon
0
885
Member Avatar for cpp.coder37

I am not sure how helpful this will be but check out this [URL="http://www.google.com/search?q=c+programs+for+usb&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a"]link[/URL]

Member Avatar for sirio.bm
0
83
Member Avatar for watery87

Adding a little bit more information to gerard4143's post Open the file (Use fopen for this) Read the first line of the file and store it in a buffer (Use fread for this) Go through the line and check if the name of the country appears in the file or …

Member Avatar for watery87
0
479
Member Avatar for nbaztec

Some more differences between C and C++ - C++ is more strongly typed than C Using the most cliched in C++ we have to typecast the value returned by malloc - I [B]think[/B] the maximum length the variable can have in C is limited to 32 chars. What I mean …

Member Avatar for mrnutty
0
573
Member Avatar for titan5

Your code is hanging because of the for loop on line 70. From the looks of it I dont think you need the loop, so might as well delete it But from a conceptual point of view I cannot understand why loop runs on infinitely

Member Avatar for titan5
0
103
Member Avatar for Buolbear4444

Objective C is quite different from C/C++ . It has lots and lots of quirks and it takes some time to get a grip on the whole thing I am not trying to discourage you but just sharing my personal experience with you

Member Avatar for papanyquiL
0
136
Member Avatar for shinsengumi

[CODE]struct temp { char name[20]; }; struct temp t1[20]; int main() { strcpy(t1[0].name,"abhimanipal"); printf("%s\n",t1[0].name); return 0; }[/CODE] Maybe this will help you ....

Member Avatar for Ancient Dragon
0
207
Member Avatar for therstonsplace

iPhone apps are usually written in Objective- C. You can use C++ in your objective -C programs but many of the common feature (constructors) are not allowed. Overall it makes way more sense to develop in Objective- C for the iPhone/ iPad platform Also iPhone does not support openGL. It …

Member Avatar for abhimanipal
0
95
Member Avatar for coolshiva
Member Avatar for okwy

This is how I would do it [CODE]int calculateAverage(int* a, int startPoint) { for(int i= startPoint; i<startPoint+5;i++) //calculate the average and store it in sum return sum } int main() { int arr[30]={1,2,3...30}; for(int i=0;i<30;i++) average[i]= calculateAverage(arr,i); // Use some error handling for the cases when i becomes > 25 …

Member Avatar for abhimanipal
0
9K
Member Avatar for chrysanterus

There are some tutorials posted at the very beginning of this forum ... Check it out

Member Avatar for abhimanipal
0
126
Member Avatar for lionaneesh

I used this reference for setsockopt [url]http://msdn.microsoft.com/en-us/library/ms740476%28VS.85%29.aspx[/url] According to this, setsock opt returms 0 for success. Change that part of code for your program.

Member Avatar for malathi renin
-1
140
Member Avatar for rajina

Did you compile the code ? Did you specify the name of the executable when you were compiling the code ?If not the default name is a.out

Member Avatar for rajina
0
186
Member Avatar for Aia

RIP Dave..... I knew him slightly but I could tell he was a great programmer and more importantly now I know he had great spirit. To post on this web site despite having cancer. Respect.

Member Avatar for sureronald
9
625
Member Avatar for iqra123

You want to compare the theoretical complexity or the difference in execution time for each of the algorithms ?

Member Avatar for Adak
0
95
Member Avatar for Jeffrey0209

Can you provide some sample inputs and outputs ? I am unable to understand what does palindrome and factorials have to do with the problem that you have posted

Member Avatar for Jeffrey0209
0
131
Member Avatar for sdinu96

This is a very brief answer to your question. For a more detailed answer try googling for it or wait for some one else to post it When a function is called the context of the current function (the contents of the stacks, the values in the registers etc, the …

Member Avatar for abhimanipal
0
105
Member Avatar for sourabhtripathi

A simple rule of thumb is finish up all the expression to the left, then come and evaluate the expression to the right of the pointer For examples: v= *p++ Go left and de reference the pointer then come and increment the pointer

Member Avatar for jaaz....
0
306
Member Avatar for libathos

What have you got so far ? Here is some thing to get you started [url]http://www.cs.cf.ac.uk/Dave/C/OLDC/subsection2_18_4_1.html[/url]

Member Avatar for kings_mitra
0
128
Member Avatar for fizzle

Can you paste the content of the input file ? Also I do not understand the rationale behind the number 80 ?Can some one explain why the size of the temp buffer is 80

Member Avatar for fizzle
0
167
Member Avatar for cktbrd

[QUOTE=kings_mitra;1274457]You can use string functions to get the substrings for each part of the time and convert it into integer to store in your variables. Try this out: [CODE]ptrToYourStr = yourStr; for(i = 0; i < 3; i++) { time[i] = atoi(strndup(ptrToYourStr, 2)); //Taking the substring and converting to integer …

Member Avatar for kings_mitra
0
271
Member Avatar for mamashi

Go over each char of the string stored in foo. If the char is a question mark, ignore it Else keep it Is the final product an integer or a char array ?

Member Avatar for abhimanipal
0
147
Member Avatar for SHENGTON

The pseudo code for bubble sort is for i=0 to i<n { for j=0 to j<n-1 { if a[j] > a[i] then swap } } Check out the wiki link for bubble sort to get a more detailed explanation.

Member Avatar for Adak
0
133
Member Avatar for vovasquez

What is the format of the numbers in your file ? Depending upon that you may have to do some string parsing ....

Member Avatar for abhimanipal
0
102
Member Avatar for vigneshbro
Member Avatar for aianne

I have not programmed much on Turbo C, specially graphics.. But I have a couple of observations. I am 100% sure if these are indeed correct ... Please correct me if I am wrong [QUOTE=Ancient Dragon;1118283]>>when I tried to run it, it suddenly closed That's because there is nothing at …

Member Avatar for Adak
0
313
Member Avatar for neti1987
Member Avatar for fkcares

There are tons and tons of books, forums devoted to answer both of the above questions.... Did you try to do a google search on this subject ?

Member Avatar for niehaoma
0
99
Member Avatar for Ferny84

The number 2 means that fgets will just read 2 chars from each line. You want to change that number to an appropriate size.

Member Avatar for Ferny84
0
91
Member Avatar for melusim

@fxwebpage Really thats your advise. If your code is not compiling then there is some error in your code !!!! @melusim Is this your code or did you copy paste from some where ?There are so so many errors in it 1. You have declared the sort function in the …

Member Avatar for terminato
-1
260
Member Avatar for manutd4life
Member Avatar for achieve_goals

According to your above post the function set_number_people is not defined to be a part of any class but yet when you call it, you use an object to call the function

Member Avatar for achieve_goals
0
113
Member Avatar for iwanttolearnc

I think the type cast has to be done before applying the shift operator. Here is an example to show why [CODE] int main() { float f= 5.67; int x= (int)f<<2; printf("%d\n",x); return 0; } [/CODE] If f is not typecasted before applying the shift operator then the code will …

Member Avatar for iwanttolearnc
0
101
Member Avatar for The 1

If you have to insert data into a binary search tree, they get inserted into the tree depending upon their data values . So if my data is 10,11,12, My tree would be some thing of this sort 10 \ 11 \ 12 \ In such a scenario many of …

Member Avatar for The 1
0
337
Member Avatar for nada massoud
Member Avatar for yasemin

fskeek can often give un predictable results when being used with text files. [url]http://www.cplusplus.com/reference/clibrary/cstdio/fseek/[/url]

Member Avatar for abhimanipal
0
131
Member Avatar for sdinu96

In the code for case 1, Your second record will over write the first one, third will over write the second record and so one. What you want to do is keep a count of how many records have already been inserted and then each time the user wishes to …

Member Avatar for abhimanipal
0
5K
Member Avatar for ChPravin

Initial array is 1,2,3,4,5,6,7,8,9,10 After rotating it 3 times 8,9,10,1,2,3,4,5,6,7

Member Avatar for ChPravin
0
136
Member Avatar for littlestewie

When you create the current pointer in line 68, it is un initialized and points to some garbage location. So when you use it in line 75 it goes into an infinite loop. The solution to your problem is to initialize the current pointer when you create it

Member Avatar for abhimanipal
0
104
Member Avatar for notdoppler

The return value for the read and write system calls is the number of char successfully read/ written. Print that value and post the result here

Member Avatar for abhimanipal
0
286
Member Avatar for xaop

I do not think that your program is crashing.... This is what happens when you enter a char other than c. Since the char is not c, the code goes to the default case, prints "press c to continue" then comes out of the switch scenario and wait for you …

Member Avatar for abhimanipal
0
135
Member Avatar for Alerwiali

I am sorry I did not understand what is your problem ?I ran the code that you have posted for 10! and I got the answer. So what is the problem ? These are the problems that I see with your code You have not checked for overflow. If you …

Member Avatar for Alerwiali
0
114
Member Avatar for darkdai

Are you running your program from the Command Line ?Then a simple solution could be to run you program like this ./test >testfile The > operator works on Linux. You might have to use a different operator for your system

Member Avatar for Aia
0
152
Member Avatar for manutd4life

[CODE]int main() { float f=10.5678; printf("%f\n",f); }[/CODE] Now if you want more precision when you are printing the floating point number google for print and you will find ways to do that

Member Avatar for Tellalca
0
92
Member Avatar for iamthwee

Same solution as the one suggested by AD but you could use a map instead of a vector

Member Avatar for iamthwee
0
281
Member Avatar for aliiya
Member Avatar for Ral78

@Aranarth Its a C- style approach. When we are program in C, all the variables have to be declared at the start of the function block

Member Avatar for Ral78
0
150
Member Avatar for Ayaat Monem

Yes you can .... But you will have to figure out what are the ASCI values of the arrow keys In future start a separate thread for your questions. Even if you feel that your question is related to the current discussion

Member Avatar for abhimanipal
0
278
Member Avatar for socket_to_me

Also what are you expecting to get when you do sizeof(argv[2]). It will give you the size of a pointer. Is that what you want ?

Member Avatar for abhimanipal
0
98

The End.