519 Posted Topics

Member Avatar for Freespider

Pattern matching is not that easy with C. Here is one approach though. If there is some specific pattern to the input then you can check it using if else statements. For example if the input is !1 \ !2 \ !3 You would say if the first char is …

Member Avatar for abhimanipal
0
97
Member Avatar for Mz3g

There are 2 big mistakes in your program 1. In the printf that you do on line 66 in the client program is causing a seg fault because of parameter mis match. Comment out that line or put the proper parameters 2. The server is waiting for the client to …

Member Avatar for abhimanipal
0
216
Member Avatar for Xufyan

One way could be to put a if condition before the mod operation. If c is equal to a, dont do the mod operation. Else go ahead and do the mod operation

Member Avatar for Xufyan
0
126
Member Avatar for gulfx01

See the objective of the program is to convert from feet to meters. If you use the information that is given in the problem statement ... you see that 10 feet = 12 inches 1 inch= 1/39.37 metres Therefore 10feet= 12*(1/39.37)metres Now the program says that accept the input from …

Member Avatar for abhimanipal
0
144
Member Avatar for manoj_rashmi

Some thing of this sort if your function is a part of the class definition [code=c] class complex { int x; int y; public : complex(int x, int y) { this->x=x; this->y=y; } void display(complex c) { cout<<c.x<<" "<<c.y<<endl; } }; int main() { complex c1(10,5); c1.display(c1); cin.get(); return 0; …

Member Avatar for abhimanipal
0
96
Member Avatar for techie929

First step will be to read from a file. You can use fread for that. [url]http://irc.essex.ac.uk/www.iota-six.co.uk/c/i2_feof_fgets_fread.asp[/url] Now the 4 bytes that you want to read will be in a character array. The next part is to assign these bytes to form a 4 byte unsigned number. This code will get …

Member Avatar for WaltP
0
2K
Member Avatar for retchedmonkey
Member Avatar for timbomo
Member Avatar for tquiva

[QUOTE=tquiva;1161692]I know that I need to edit somewhere in the skipBlanks function. But I just can't seem to think straight anymore. I was thinking of declaring both \n and ; as characters. then setting them to equal each other. Is that good enough?[/QUOTE] HINT: Make a change in line 70 …

Member Avatar for jephthah
0
213
Member Avatar for keerpitis

In line 20, for one of the conditions you have used the = operator instead of the == operator. = means assignment, where as == means checking for equality. Make the change, compile and run the code. Post what error you are getting Also you might want to google for …

Member Avatar for abhimanipal
0
83
Member Avatar for ammarZ

[QUOTE=ammarZ;1161465]wow thanks for the cool help! I see what your're saying about subtracting the decimal value of a from the characters so we get like 1, 2, 3 etc for b, c, d, etc.. but I don't get the exact array thing.. like if i do that it'll increment the …

Member Avatar for jephthah
0
115
Member Avatar for newbiecoder

[QUOTE=newbiecoder;1160167]I want my code to take two characters and print them, but this code only takes one character, prints it and terminates, can you please tell me what's wrong with it? Thank you. [code=syntax] #include <stdio.h> int main() { char a, b; scanf("%c", &a); scanf("%c", &b); printf("%c %c\n", a,b); return …

Member Avatar for newbiecoder
0
257
Member Avatar for dondajr

Make a header file.... Say file1.h. Include all the header file and function declarations is this file. For ex [code=c] #include<stdio.h> #include<string.h> void display(int,int); [/code] Then make a .c file. Put all the function declarations in this file. Include the header file, file1.h in the source code file [code=c] #include …

Member Avatar for jephthah
0
152
Member Avatar for yapkm01

When you declare some thing of the sort [code=c++] int int1; [/code] The compiler gives any arbitrary value to i. This could be 0,1,2,... any value what so ever. As you input a char in response to the second cin, the compiler ignores the value entered by you. Later when …

Member Avatar for vmanes
0
113
Member Avatar for infrapt
Member Avatar for kng

When we multiply 2 matrices, each element of the first row of the first matrix is multiplied with each element of the first column of the second matrix and so on If you can bring one row of the first matrix and one column of the second matrix into the …

Member Avatar for abhimanipal
0
146
Member Avatar for Spiderpig085

You might want to try the function gettimeoftheday() PS I am not sure of the arguments

Member Avatar for abhimanipal
0
171
Member Avatar for prushik

I am not sure if this will help but Could it be the case that the int that you are passing to the sleep function is 2 big (the value has over flown )

Member Avatar for prushik
0
269
Member Avatar for abhimanipal

Hello Everybody, Most of my coding experience is in C. Although I have a background in C++, I know very little of STL and the advanced topics in C++. I came across this code [code=c++] struct g { g():n(0) { } int operator()() { return n++; } int n; }; …

Member Avatar for mattjbond
0
160
Member Avatar for PDB1982

You do not need to make different functions for each object. Also your print function is wrong Read up the concepts of objects one more time and you will see that you just need one getter / setter methods per class PS: Change your void main to int main

Member Avatar for tetron
0
530
Member Avatar for johndoe444

[QUOTE=johndoe444;1120400]The following code fragment from Programming Pearls: [CODE]for i = [0, n) if comlen(a[i], a[i+1]) > maxlen maxlen = comlen(a[i], a[i+1]) maxi = i[/CODE] I am not sure why he called the comlen function twice? Instead he could save the computed value in a temporary and use it to assign …

Member Avatar for rdxblast
0
132
Member Avatar for Idontknowc
Member Avatar for Ancient Dragon
0
121
Member Avatar for DavidDD

Use an enum. Define all the 13 cards in the enum [code=c] enum card { one=1, two=2, ...... jack=11, queen=12 }; [/code]

Member Avatar for WaltP
0
114
Member Avatar for tinkerkyala

Your problem is that in the convertToPostfix function your are returning a null stack. Print out the content of the top of the stack just before you return it . The content prints out to be -1 . Consequently in the eval function when you check to see if the …

Member Avatar for abhimanipal
0
126
Member Avatar for ah.MirZan

Why is the username and password integer datatypes ? Why have you used cprintf ? Syntax of fwrite is wrong

Member Avatar for WaltP
0
241
Member Avatar for CreativeCoding

If after resolving the memory issue you are still getting file not found, I will suggest that you take the full path name of the directory

Member Avatar for thomas_naveen
0
202
Member Avatar for ganesanronaldo

Some suggestions 1. Print the contents that you read from the files. In line 133 2. Why are you not considering the value returned by the searchList function- Line 135 3. Also when you call the insert function. What parameters are you sending into the function 4. Google for "insert …

Member Avatar for ganesanronaldo
0
139
Member Avatar for lethal.b

One solution could be to replace the '0' by ' ' ie the space character. Is this allowed ? Make a temp array and run a for loop over the alpha array and each time the character is not a (0 or ' ') copy it to the temp array.

Member Avatar for jonsca
0
112
Member Avatar for tarheelfan_08

Quick question. Have you ever included files before ? If no then I think for some reason the header files in the main class are not getting included. That is why, when you call the constructor of the classes defined in those files you are getting an error.

Member Avatar for thomas_naveen
0
204
Member Avatar for alfroad

Is it some thing of this sort ? Multiply all numbers from 1- n with the number 2 ? If this is it then a simple while loop will suffice

Member Avatar for abhimanipal
0
86
Member Avatar for softapu
Member Avatar for abhimanipal
0
336
Member Avatar for romariejhoanna

If you are having trouble getting started, think on the lines of linked lists. Store each number in 1 node of a linked list. So now the size of the number is not a criterion any more. So for adding just scan both the lists and store the result in …

Member Avatar for romariejhoanna
0
243
Member Avatar for unbrknchane

You are passing the arrays by value. The changes made to these arrays will be local to the function. Pass by pointer or use global variables

Member Avatar for Adak
0
112
Member Avatar for crimsonwave

If you have an array of 4 characters, then you have 32 bytes... Will this work for your application ?

Member Avatar for Ancient Dragon
0
123
Member Avatar for infrapt

One suggestion is to remove the data declarations from line 47-48 and put then at the beginning of the function. In C all data declarations have to be at the beginning of the function Put some printfs in your code, narrow down the area where you are getting the problem. …

Member Avatar for abhimanipal
-1
1K
Member Avatar for Silent_Friend

E. Balaguruswami is not a good author. I was reading his C++ book and it has many mistakes. Most notably the use of void main all over the place I would recommend, Let us C, by Yashwant Kanitkar

Member Avatar for abhimanipal
0
143
Member Avatar for kendaop

[QUOTE=gerard4143;1148669]Try setting hold[0] = '\0'; Or you may try using buffer[0] == '|'[/QUOTE] buffer[0] means *(buffer + 0) which can be simplified as *(buffer) This is obviously same as *buffer

Member Avatar for abhimanipal
0
127
Member Avatar for Don_k
Member Avatar for abhimanipal
0
126
Member Avatar for Don_k

Also I would advise clearing out the contents of array1 and array2. As these arrays are local variables they will contain junk values and this could affect your out put

Member Avatar for Dave Sinkula
0
122
Member Avatar for aliase

fork system call returns the process id of the child and parent. You could use this information

Member Avatar for abhimanipal
0
77
Member Avatar for nhalavanja

Check out this link [url]http://akomaenablog.blogspot.com/2008/03/c-thread-example.html[/url] This maybe of help

Member Avatar for Salem
0
1K
Member Avatar for donelliewhyte
Member Avatar for xavier666

Can you tell me where did you write the print function ? I wrote the print function in the main after the sort function was called and I was able to print the array elements just fine.

Member Avatar for xavier666
0
4K
Member Avatar for tquiva

One method could be to store all the input numbers in an array. Then find the max and min of this array. If you google you might even get the code for these functions. Your current approach is quite complicated. You dont need so much complication

Member Avatar for tquiva
0
229
Member Avatar for andreski
Member Avatar for Xufyan

[QUOTE=Xufyan;1146196]Hello everyone i am new in C language and need some basic help. see this program, [CODE] void main(void) { int a,b; clrscr (); { for (a=1;a<5;a++) { for (b=2;b<6;b++) { printf ("value of a is %d , value of b is %d \n",a,b); b=a+1; a=a++; } } } getch(); …

Member Avatar for shah1248
0
296
Member Avatar for MWE_QUE

In the main function you call print on line 107.. Before that can you print the entire array of structs ??

Member Avatar for MWE_QUE
0
129
Member Avatar for whoamineo89
Member Avatar for Ancient Dragon
1
5K
Member Avatar for COKEDUDE

You could use exit as well. But for this situation it is more appropriate to use the suggestions mentioned above

Member Avatar for abhimanipal
0
145
Member Avatar for programer411

Or you can make n as a global variable Max can be calculated in the function as well

Member Avatar for programer411
0
151

The End.