15,551 Topics
| |
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 … | |
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 … | |
[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] | |
how can i go back to the previous line if user enters a wrong input, im using C programming | |
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 … | |
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 … | |
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> … | |
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" … | |
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) … | |
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 … | |
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) { … | |
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() ? | |
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 | |
[code]main() { int a=5; a=++a + ++a; printf("%d",a); }[/code] the output is 14..how come? | |
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 … | |
Please help to make a code of the josephus problem in C using the circular linked list. | |
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? | |
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)) ; … | |
[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 | |
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 … | |
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 … | |
[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); … | |
[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; } … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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 … |
The End.