15,551 Topics

Member Avatar for
Member Avatar for jember

Please hep me with this problem: I am having a problem with string handling using c language. This is actually an assignment. Here's how the whole program must work: 1. User must input a [B]valid password[/B] 2. Once the user inputted a valid password, it will access to an employee's …

Member Avatar for jember
0
494
Member Avatar for thorn101

Recently I started learning c and was experimenting with arrays and passing them between functions. Now I have written a simple piece of code which has two functions one for generating random numbers and putting them in an array of size 50 and one function to display the contents of …

Member Avatar for deceptikon
0
161
Member Avatar for eranga246

[CODE]#include<stdio.h> #include<conio.h> int main(){ float Area; float r,h; #define pi 3.41; printf("enter the radius of the circle in centimeters\n"); scanf("%f",&r); printf("enter the height of the cilinder in centimeters\n"); scanf("%f",&h); Area=(pi*r*r)+(pi*r*h); printf("THE AREA OF THE CILINDER IS:%f",&Area); return 0; getch(); } [/CODE]

Member Avatar for gusano79
0
136
Member Avatar for zee93
Member Avatar for deceptikon
0
3K
Member Avatar for greatbuttar

hi everybody! :) I have 4 tables in my mysql database as user car_description techniqual_description saled_serial_numbers In user table user_name is the primary key. In car_description there is car_id as primary key and serial_number as foreign key which is primary key in table saled_serial number and user_name as foreign key …

Member Avatar for jbennet
0
122
Member Avatar for Alfy

I am kinda new to world of c programming, and i have been assigned a problem that is written as follows: Write a procedure that counts the number or words in a string. Write a program to test your new procedure. I am kinda lost on this completely. Any help …

Member Avatar for zeroliken
0
2K
Member Avatar for Gaiety

Hi All, I have read that the system call "execlp" will take the first arguement as the file name(or path), second arguement as the command and all others are arguements to the command terminated by NULL. i have written below program. [CODE] #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> …

Member Avatar for Gaiety
0
165
Member Avatar for cdea06

I'm trying to improve the validity checks in my program, but no matter what I do, I can't seem to come up with one that catches the following: 1) If you input "enter" "enter" the program reads it as a valid anagram. 2) if you input all number "33467" "22113" …

Member Avatar for cdea06
0
83
Member Avatar for faithful4ever

I have an array of structures: [CODE]typedef struct { char name[20]; int ID; int status; } seat;[/CODE] Then, basically, I'm trying to print out the list of empty seats in a reservation system. [CODE]void listEmpty(seat plane[MAXCAP]) { int i; for(i = 0; i < MAXCAP; i++) { if(plane[i].status == 1) …

Member Avatar for Ab000dy_85
0
221
Member Avatar for karan173

i m trying 2 find all primes between 2 nos using sieve. but somehow only 2 is being set as prime, pls help me in finding the problem [CODE] #include<stdio.h>//1==t for prime #include<stdlib.h> #define MAX_LIMIT 100 char flags[MAX_LIMIT+100]; void set_seive(void) { /*setting of flags for prime nos. by sieve of …

Member Avatar for WaltP
0
176
Member Avatar for Graphix

Hi everyone, I'm currently working on a cross-platform project to copy data from the computer onto a USB drive quickly. [B]Main problem: EOF in the middle of the file[/B] It's going good so far, but I stumbled across a problem in my copy_file function: [CODE]int copy_file(char *source_path, char *destination_path) { …

Member Avatar for Graphix
0
2K
Member Avatar for dbsp

I've read many threads on how to remove a new line character '\n' using fgets()-- however, how would one go about removing a new line character simply by using getchar() ?

Member Avatar for deceptikon
0
2K
Member Avatar for cutterpillow20

Good day, can you give me some sample program that hold string in 3 dimensional array.. because our instructor didn't expound the discussion about multidimensional array then is it useful in our final project this semester..Hoping for reply Thank You

Member Avatar for cutterpillow20
0
364
Member Avatar for Esmerelda
Member Avatar for WaltP
0
294
Member Avatar for cdea06

So the project is to write a program (for a beginners C class) that compares 2 words and see if there anagrams of each other. I'm about halfway through the program and it was working fine until i tried to add the IF STATEMENTS with isalpha. What I'm trying to …

Member Avatar for cdea06
0
453
Member Avatar for davidTechy
Member Avatar for coding101

When my os starts and i log in, the Network Manager displays a list of available networks. How can I code a C program to get a list of avaialble networks. Arp requests? What is the protocol?

Member Avatar for jbennet
0
47
Member Avatar for Abhineet.Ayan

Hi All, Why my QueueUserWorkItem is not at all working. My code is here: [CODE] typedef struct { PCHAR URL[MAX_URL] ; PCHAR DestinationPath ; }MAINDATA, *PMAINDATA ; int main(int argc, char * argv[]) { PMAINDATA pData ; BOOL bQuwi ; DWORD dwIndex ; PCHAR pURL ; pData = (PMAINDATA)malloc(sizeof(MAINDATA)) ; …

Member Avatar for DeanMSands3
0
639
Member Avatar for rithish

[CODE]#include<stdio.h> #include<string.h> void main() { char str[20],cmp[20]; int x; printf("enter the string : "); gets(str); printf("enter the string 2 : "); gets(cmp); x=strcmp(str,cmp); printf("%d",x); } [/CODE] my doubt is how strcmp returns an integer ??how will it take the words

Member Avatar for deceptikon
0
101
Member Avatar for student_learner

i found this code in a book. i am finding it confusing. [code] #include<stdio.h> int main() { int arr[3]={2,3,4}; char *p; p = (char*)arr; // line A p = (char*)((int*)p); printf("%d",*p); p= (char*)(p+1); //line B printf("%d\n",*p); return 0; } [/code] the answer is: 2 0 but i cant figure out …

Member Avatar for DeanMSands3
0
231
Member Avatar for niyasc

I'm trying to design Programmable Logical Array using c language. Due to lack of time I downloaded code for tabulation from internet. Now I have modified it to return f and f' in a character array. It works fine for some functions. But it shows memory allocation problem for some …

Member Avatar for Abhineet.Ayan
0
275
Member Avatar for smith32

[CODE] sem_t w,r,s1,s2,s3; pthread_mutex_t m; int main(int argc, char* argv[]) { mutex and semaphores initialization ..... call threads.... wait until finish and cancel threads... clean threads and semaphores [I]exit;[/I] } void *reader(void *argv) { while(TRUE) { sem_wait(&r); sem_wait(&s1); pthread_mutex_lock(&m); ... read data..... pthread_mutex_unlock(&m); sem_post(&s1); sem_post(&w); } printf("Done read\n"); sem_post(&extra2); pthread_exit(NULL); …

Member Avatar for Abhineet.Ayan
0
172
Member Avatar for andrewpw

[CODE=c]int OperateGumBallMachine(void){ int total = 0; char input = getchar(); RefillGumBallMachine(); for(input; input != 'x'; input = getchar()){ if(gMachine.iNumBlueGumBalls + gMachine.iNumGreenGumBalls + gMachine.iNumRedGumBalls == 0){ RefillGumBallMachine(); } switch(input){ case 'n': total += NICKLE; if(total >= QUARTER){ total -= QUARTER; DeliverGumBall(); printf("Your change is %d cents\n", total); total = 0; } …

Member Avatar for Gaiety
0
3K
Member Avatar for Labdabeta

I have some code in C++ that uses an std::vector of std::strings to store an array of strings. I need to convert it into C. I thought that I would just create c versions of the functions I need (vector.back,vector.push_back,string.operator+=) but am getting lost in the double pointers. Can anybody …

Member Avatar for Ancient Dragon
0
177
Member Avatar for balajirs

If I mprotect a segment with PROT_NONE and if a SIGSEGV occurs due to a write which gets handled by sigaction with sa_sigaction, We will be able to find the address where the fault occurs using siginfo_t's si_addr. Is there a way to know the data that was tried to …

Member Avatar for balajirs
0
151
Member Avatar for mithunp

This version1 of the code is a recursive function to print n to 0 values, but there is no return statement, is it using the return value of printf The version 2 of the code prints from 0 to n,and it worked even if we remove the return keyword as …

Member Avatar for Smileydog
0
172
Member Avatar for arold10

I am trying to write this code, but I am having problem with using floating point in the while. The code works, but when I input the number, I get some strange result. What's wrong? [CODE]#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int hourWorked; double hourlyRate; double …

Member Avatar for arold10
0
198
Member Avatar for Ungodlyrich

I wanted to create a simple table by printing lines in between my values with a header at the top and my numbers left justified. However, when I get to a ten digit number or larger, my code seems to break and my count variable goes to zero as far …

Member Avatar for newlearnerIV
0
9K
Member Avatar for MrNo

[CODE]#include <stdio.h> #include <string.h> int main() { int count = 0; char *doc; FILE *inp; printf("Enter the file name: "); scanf("%s", doc); inp=fopen(doc, "r"); while((doc = fgetc(doc)) != EOF) { if (doc == ' ') count++; } fclose(doc); printf("%s contains %d words\n",doc,count); return 0; } [/CODE] So basically I'm a …

Member Avatar for zeroliken
0
316
Member Avatar for shean1488

Hi everybody. I'm trying to write the program that will read the file and delete blank spaces ONLY after the text. here is the text : [CODE]serg@serg-PORTEGE-Z835:~$ cat sample.txt Now is the [/CODE] here is the the same in hex: [CODE]serg@serg-PORTEGE-Z835:~$ od -x sample.txt 0000000 2020 2020 2020 2020 2020 …

Member Avatar for subith86
0
139

The End.