15,551 Topics

Member Avatar for
Member Avatar for COKEDUDE

Could someone explain where and when you would use << and >>. I read these 2 articles but don't really understand them. [url]http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B[/url] [url]http://en.wikipedia.org/wiki/Arithmetic_shift[/url]

Member Avatar for gerard4143
0
108
Member Avatar for COKEDUDE

With my code below how would I either ignore or remove decimal numbers? I tried typecasting it but that messed up my code. I can't think of any way to make a loop to accept only integers either :(. I don't understand why the scanf is accepting decimal numbers when …

Member Avatar for WaltP
0
197
Member Avatar for bufospro

Hi all, I have to make a function which take as parameter two arrays and merge in one new. For example int array1[][] = {{1 , 2, 3, 4}, {2, 3, 4, 5}}; int array2[][] = {{5 , 6, 7, 8}, {6, 7, 8, 9}}; To take as result arraynew[][] …

Member Avatar for ndeniche
0
130
Member Avatar for COKEDUDE

Can someone tell me why my compiler won't compile this code and how to fix it? [CODE]void gcd(int x, int y) { if (x > y) { int c; while(1) { c = x % y; return y; x = y; y = c; } if (y > x) { …

Member Avatar for COKEDUDE
0
181
Member Avatar for jamesl22

I'm new here so please bare with me if this is the wrong forum (sorry if it is). I put it here because I believe you can contruct a kernel in c right? I've downloaded the linux kernel and thats full of c source files. Anyway, i've been using windows …

Member Avatar for manutm
0
141
Member Avatar for Hawkpath

Hey, my friend and I made this website: [url]http://www.letslearncpp.forumstech.com/[/url]. This website is complete with text and video tutorials made by my friend and I. Please visit this website and join it if you want to. Thank you.

Member Avatar for Hawkpath
0
194
Member Avatar for maprinz
Member Avatar for k4utoall

[b]Split from - [url]http://www.daniweb.com/forums/thread118867.html[/url] [/b] [code] int main() { int i , parent_id , ans ; parent_id = getpid() ; for ( i = 1 ; i <= 5 ; i++ ) { if ( getpid() == parent_id ) { ans = fork() ; wait() ; } if ( ans …

Member Avatar for kvprajapati
0
74
Member Avatar for techno_weenie

I need to parse a file line by line and check if the line is in a valid BNF format and print it out if it is. Below is my BNF grammar: <line> ::= <program names><spaces><uids><spaces><dest IPs><spaces><ports> <spaces> ::= <blank character> | <blank character><spaces> <blank character> ::= ' ' | …

Member Avatar for IsharaComix
0
131
Member Avatar for rico.tee

Good day. I need help on a program that I'm working on. It's supposed to take the strings in input.txt and put the odd numbered lines to odd.txt and the even ones to even.txt. here's the code I have made so far... [CODE] #include<stdio.h> #include<stdlib.h> #define p printf #define s …

Member Avatar for abhimanipal
0
152
Member Avatar for techno_weenie

Hello, I'm trying to split a string into 4 separate strings using a delimiter "\n" The initial string is: "/usr/bin/ssh \n * \n 147.188.195.15, 147.188.193.15, 147.188.193.16 \n 22" I would like it to be split up into four different char's so that char *programnames = "/usr/bin/ssh \n" char *uids = …

Member Avatar for jephthah
0
143
Member Avatar for newcuser

Here is the output for the following code. Can someone help me put the five prods on rows and sales reps on columns w a few changes??? Enter seller's code (-1 to exit): 2 Enter product code: 2 Enter sold for seller 2, product 2: 2 Enter sellers code (-1 …

Member Avatar for jephthah
0
74
Member Avatar for abhimanipal

[code=c] int main(int argc, char* argv[]) { int a=3,b=2,c; a=a==b==0; printf("%d\n",a); return 1; } [/code] I cannot understand why this code gives 1 as the answer. According to me , this should be the order of evaluation b==0, which gives false & the expression becomes a=a==0 this should again give …

Member Avatar for IsharaComix
0
113
Member Avatar for yona
Member Avatar for sahiti
Member Avatar for Dave Sinkula
-5
135
Member Avatar for banders7

A program that handles either piped input (command/prog | your_prog) or file redirected (your_prog < file_name) input. Determine whether such input exists before issuing a stdin read so that the program does not go into a "waiting for input" state. Written in/for the XP environment.

Member Avatar for jivemaster
0
628
Member Avatar for yila

two static arrays size 10 need to be copied to an empty target array size 20. like this: you copy from the first array the nums till arr1[i] = 0 then you switch to the second array and copy to the nums till arr2[i] = 0. then you switch back, …

Member Avatar for yila
0
158
Member Avatar for aya_brea

Iam a freshmen and we're given a task to program a calendar using turbo C and does'nt exceed line 54 and some texts are with specific colors.(red) for the days under sunday,(light gray)for the month.... I will really appreciate your help thanks....... Here's the format: ex: enter month:1 january 2004 …

Member Avatar for peter_budo
-3
2K
Member Avatar for newcuser

I have gotten my program to the point that it allows me to enter the data I want to enter. However, I do not know how to get the program to loop back correctly and ask for salesperson number and stop the loop when I enter -1. Help![CODE] #include <stdio.h> …

Member Avatar for jonsca
0
200
Member Avatar for chriselda

deleting string... example: deleting... enter string: the quick brown fox and the lazy dog. enter string to delete: the([I]the first one[/I]) new string: quick brown fox and the lazy dog.

Member Avatar for Dave Sinkula
0
112
Member Avatar for klactose

Hello all, I have a program that creates an array of structs. It is consistently exhibiting 1 of 2 problems and I can't figure out exactly what is wrong, but the problems seem related to each other. Problem 1: For some reason the category member of the mediaItem struct fails …

Member Avatar for gerard4143
0
172
Member Avatar for adrawat

Hi, Im trying 2 write the contents of a input file to an output file in reverse order using file I/O in C. Is there a more efficient way 2 do it? [CODE] int main() { FILE *fp1,*fp2; char ch,arr[100]; int i=0; if( (fp1 = fopen("input.txt","r")) == NULL ) { …

Member Avatar for adrawat
0
387
Member Avatar for newcuser

Hello, I am attempting to rewrite a program in c. Here is what I have so far. Thanks in advance for assistance. [CODE]#include <stdio.h> void sales[ salesPerson ][ product ] += value; int main() { const int PEOPLE = 5, PRODUCTS = 6; double sales[ PEOPLE ][ PRODUCTS ] = …

Member Avatar for mitrmkar
0
179
Member Avatar for dragontruong

I am unable to print out the error message when there is no input. I've tried different methods for it, but I can't get it to work. What am I missing? print should be: p2 invalid input but I get: p2 segmentation fault when I do this with an int …

Member Avatar for dragontruong
0
108
Member Avatar for daveoffy

I have been trying to get the day of the year into an int(0-365). I have tried the time.h library and did int tm_yday but it returned an incorrect number. I am using Linux. G++(gcc) compiler. Thanks for the help.

Member Avatar for daveoffy
0
174
Member Avatar for exonwarrior

Hey all, I'm writing a program in C++ for a contest. The code executes no problem on my computer at school that I'm writing it on. I get all the correct answers. When I upload it however, it keeps on saying "runtime error (SIGSEGV)" Please Help!! here's the link to …

Member Avatar for Salem
0
165
Member Avatar for Iam3R

Hi, i understand the ieee 754 representation. but can some one explain why we need to add specifically 127 to the power of 2. for ex: 5.75 ; 101.110 can be written as 1.01110 * 2 ^ 2 127 +2 = 129 . i.e 10000001 now IEEE 754 of 5.75 …

Member Avatar for Salem
0
75
Member Avatar for Iam3R

below is one simplest code to illustare the pyramid of number. [CODE] void piramid(int const c) { int r, x; for (r = c; r > 0; r--) { for (x = 1; x < = (2 * c - r); x++) { if (x < r) printf(" "); else …

Member Avatar for yila
-2
99
Member Avatar for katwalatapan

Hello, I have a query on dynamic allocation of memory in C. I am storing 4 seconds of audio data in a buffer allocated with sufficient memory using malloc function. If I wanted to record another 4 seconds of audio in the same buffer, I would have to increase the …

Member Avatar for katwalatapan
0
184
Member Avatar for hno

HI I want to write a class that it gets two decimal numbers and add them without using decimal expression like double and float . for example 12/05 + 1/98 =14.3 How can I do so ? thanks

Member Avatar for Ancient Dragon
0
44

The End.