15,550 Topics

Member Avatar for
Member Avatar for Castiel1631

I have a while loop reading names from a file and placing them in an array. When I print the contents of the array, it prints the last name that went through the loop, so I'm assuming that as the loop is progressing each time the names are being rewritten. …

Member Avatar for IsharaComix
0
137
Member Avatar for Rahul.menon

I wanna write a code which would add the digits before decimal and after decimal. eg:- 12.22 would add upto 3.4 , 491.941 would give 5.5 [CODE] #include<stdio.h> #include<conio.h> #include<string.h> void main() { double a1[5],a ; //array of 5 numbers int b,len,i,sum=0,cnt = 0; char ch[10]; for(i = 0;i<5;i++) // …

Member Avatar for Ancient Dragon
0
146
Member Avatar for araujfrnk

#include<stdio.h> #include<stdlib.h> void show(const double a[], unsigned elements); int main() { const unsigned elements=10; const double a[10]={0,1,2,3,4,5,6,7,8,9}; printf("\t\tArrays and Pointers\n\n"); show(a,elements); return 0; } //FUNCTION 1 void show(const double a[], unsigned elements) { unsigned x; printf("\nValues in Array are :\n"); printf("[%u]:",elements); for(x=0; x<elements; ++x) { printf("%d",a[x]); } printf("\n\n\n"); } Output: …

Member Avatar for Ancient Dragon
0
113
Member Avatar for Rahul.menon

[CODE] #include<stdio.h> #include<conio.h> void main() { int num[50],i,i1,j,temp = 1,cnt = 0; printf("How many elements "); scanf("%d",&i); printf("Enter the elements "); for(j = 0;j<i;j++) { scanf("%d",&num[j]); } i1 = 0; j=1; while(i1 < i ) { for( ;j<i;j++) { if((num[j] < num[i1])&& (i1<i)) { temp = num[j]; //algorithm for sel …

Member Avatar for Rahul.menon
0
92
Member Avatar for nikolai090

Hi there, is it possible leave a scanf blank? For example my code is: [code=c]scanf("%s%s",&a,&b);[/code] After entering the string for "a", I would like to leave "b" blank so I press enter but it just jumps over to the next line, is there a way to leave a "b" blank? …

Member Avatar for nikolai090
0
110
Member Avatar for TheBaby7591

I'm supposed to create a program that reads in the name of a file, then takes the names of students, which are listed (last, first, m) and concatnate the first with the last (firstlast) and add .dat at the end for each student to open a file with and unknown …

Member Avatar for TheBaby7591
0
108
Member Avatar for iwanttolearnc

good day guys. i was studying a particular block of code and came across an operator: ->. im not exactly sure what it does. i found some notes saying that ptr-> is equivalent to(*ptr). for the life of me i just cant see how that applies here. care to help? …

Member Avatar for iwanttolearnc
0
96
Member Avatar for myk45

Hello. im having a little problem with file inclusion. im getting the following errors: error LNK2005: "long * addresses" (?addresses@@3PAJA) already defined in rere.obj fatal error LNK1169: one or more multiply defined symbols found My 3 files are as follows: mainFile.c [CODE]//Program for a singly-linked list #include "def.h" #include<stdio.h> #include<stdlib.h> …

Member Avatar for myk45
0
105
Member Avatar for keichi19

hi! i'm a beginner in using turbo c can anyone help we with these problems? help will be very very very very very much appreciated C PROGRAM # 13: INCLUSIVE VALUES Write a program that asks the user for a starting value and an ending value and then writes all …

Member Avatar for keichi19
-3
709
Member Avatar for Mikeysaxton

Okay so the object is to print a wheel based on the user's input of the inner and outer radii. I've written a program that checks to see if the distance of the x and y is within the radius. However, i get some weird stretched out tire. If anyone …

Member Avatar for Mikeysaxton
0
201
Member Avatar for modaslam

Can any one help me to optimize this code. Or possible to alter and make it more simple The out put i need to get is [CODE] 1 212 32123 ....... [/CODE] this is the code [CODE] main() { int i,j,k,n=4,val,flag=0; for(i=0;i<n;i++) { for(j=1;j<n-i;j++) putchar(' '); val=i+1; flag=0; for(k=0;k<2*i+1;k++) { …

Member Avatar for heznenkiah
0
107
Member Avatar for Danny_501

Hi all, I'm making a client server program in Linux. I use fork() to create a child process of the server to handle a new client. When a client disconnects it should kill the child process. At the moment the program is able to kill the fist client(server) that connects, …

Member Avatar for Danny_501
0
110
Member Avatar for Mittwaffen

I'm in a rough situation, i'm currently re-reading all of my textbooks to assist me with this work, however I am really in a rough spot being time limited I really want to get somewhere from what I have (and fix what I have). What I need to correct/add. -I …

Member Avatar for Schol-R-LEA
0
111
Member Avatar for poojabi

pls tell what is the difference between this two 1)taking a initger (or any fundamental data type) pointer in the main function and then send it to some funtion as parameter. int *p; function(p); 2)taking a intiger and sending its adress to any function. int p; function(&p); will both do …

Member Avatar for poojabi
0
140
Member Avatar for thm

I'm trying to write a matrix multiplication program that takes in an int N on command line, creates two NxN matrices A & B, randomly populates them with ints, and then computes the result of multiplying A and B. I wanted to avoid malloc, but the first version started segfaulting …

Member Avatar for thm
0
265
Member Avatar for moonlight06

Can some one please recommend me a link or the code for converting binary to decimal, hexadecimal and octal. Another for converting octal to binary, decimal and hexadecimal. Thank you and please help. I really do need it. Again, thank you and have a nice day! :)

Member Avatar for moonlight06
0
560
Member Avatar for Danny_501

I can't get strcmp() to return 0 with the following code. please help.. [CODE] char quit[10] = "q"; scanf(buf, ""); fgets (buf, 100,stdin); fflush(stdin); if(strcmp(quit, buf) == 0) { printf("Quiting program\n"); ...[/CODE] when I type 'q' into the command line it should enter that if statement, but it doesn't.

Member Avatar for myk45
0
669
Member Avatar for nejie18

how to create a password program in c++ .. please give me some code .. thanks

Member Avatar for myk45
0
88
Member Avatar for macrogeek

Hello everyone...!! I want to know what exactly is the concept of Abstract Data Types and how is it related to data structures...? I tried some standard books on this topic but found them too complicated for me to understand Thank you

Member Avatar for Momerath
0
39
Member Avatar for nk28

Hey everybody, I saw the thread for this in c++ but I want to know this for c language. I want to write a program in c that lets me calculate the heap memory size available to malloc function as well as the amount of size currently allocated. Can anyone …

Member Avatar for griswolf
0
167
Member Avatar for myk45

Can anyone please explain why a self reference on a structure is allowed, but not a variable of that type? This is what i mean: [CODE] struct node{ int a; struct node *n1; }; /* This is allowed */[/CODE] [CODE]struct node { int a; struct node n1; }; /* But …

Member Avatar for myk45
0
92
Member Avatar for sree_ec

Any suggestions on the best online tutorial/ebook/printed book regarding C libraries and latest c std? I would like to get more coverage on FILE I/O s Thanks in advance

Member Avatar for itpungaraja
0
238
Member Avatar for hoganmadman

i am trying to do a program that reads in an arbitrary number of lists of integers. SPECIFICS -A valid list of integers consists of AT MOST (could be less than) 20 integers. -You can be given less than 20 numbers. -You might be given more than 20 numbers. This …

Member Avatar for fdsa99
0
438
Member Avatar for lionaneesh

[CODE] #include<stdio.h> int main() { FILE *point; char others[35]; int indexer,count; strcpy(others,"Additional lines."); point = fopen("tenlines.txt","a"); /* open for appending */ for (count = 1;count <= 10;count++) { for (indexer = 0;others[indexer];indexer++) { putc(others[indexer],point); /* output a single character */ putc('\n',point); /* output a linefeed */ } } fclose(point); getchar(); …

Member Avatar for Ajinkya Naik
0
165
Member Avatar for nalawade41
Member Avatar for MWE_QUE

This is for an assignment. The child process never prints it's output, or calls the fibonacci functions. I've got other sample programs where the printf command works. Any help would be appreciated. Thanks in advance. [CODE] #include <stdio.h> #include <stdlib.h> #include <sys/wait.h> #include <errno.h> #include <unistd.h> #define MAX_SEQUENCE 10 typedef …

Member Avatar for MWE_QUE
0
125
Member Avatar for rohit_static

Hi , i have to merge two arrays that are already sorted in ascending order .Somehow my code doesn't give the correct output .Can someone please help [code=c] include<stdio.h> #include<conio.h> void merge(int a[],int b[],int m,int n); int main(void) { int a[20],b[20]; int i,n,m; printf("\nEnter the number of elements in array …

Member Avatar for Ancient Dragon
0
196
Member Avatar for stan lee

hi a set top box is connected with the tv testing the source signal resolution is 720x480i and the tv resolution is 1280x720p... the signal resolution is converted to tv resolution and proper output should be displayed.This was the process Here we have to change different resolution for tv and …

-1
127
Member Avatar for yesamin
Member Avatar for mpassaglia

Hello all, I have an assignment that seems to be fairly popular. I've done some searches to see if I could resolve my issue but haven't stumbled across the exact problem I'm having. This is the assignment: [QUOTE]A parking garage charges a $2.00 minimum fee to park for up to …

Member Avatar for Ancient Dragon
0
2K

The End.