15,551 Topics
| |
I am using fgets to read lines of a file. I am then using if statements based on the location of the new line character to decide which sscanf to use. I have been getting a lot of windows files which usually use carriage returns. Most of the timeit "seems" … | |
what is the usage of getch() function? how to creat recovery softwear? | |
Help me with ur inputs, how to insert and move the image using C language.. we can use by using "Type Argument Approach" to move the image?? | |
My IDE codeblocks 10.05 cant run a program which is overloading functions. Any help please..maybe due to settings | |
How to rectify the segmentation fault in LINUX system in C language? | |
I am trying to copy a string to an array of string. I have used these two examples before and they have worked so I don't understand why they won't work this time. I am getting a segmentation fault. http://stackoverflow.com/a/1088667/985898 http://stackoverflow.com/a/1095006/985898 I remembered to initialize everything. char *strings_mneumonic_table[503] = {0}; … | |
How would you go about converting a decimal value to hex and then do math? Every example of converting decimal to hex that I have seen creates an array and I wouldn't be able to do math if I did that. Something like this. 15 decimal to hex F 17 … | |
I have an array of characters. I am trying to find "houston". The only way I can think of to do this is to use a for loop and check each individual character. Is there an easier way to do this? char string[] = "Fishing tourism miami atlanta dallas houston"; | |
Hi, I have to create a program that creates N child processes, and they muliply the matrix. I have some base codes but when I try to run them they give me segmentation error and I cant find the problem. #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <sys/types.h> … | |
Hi, I am making program that finds solution how to put 12 knights(horses) to chess board that every square is dominated or engaged by other knight. Look at my code: #include <stdio.h> #include <stdlib.h> #include <stdbool.h> //(*******************************************************************************) void addNulls(char L[][9], int N[], int M[]) { int i,j,g; for (i=1 ; … | |
I am trying to clear the first character of my array. The first two methods don't seem to work. The third method seems to but doesn't look like a good idea. char operand[] = "abc"; //both methods seem to null it out operand[0] = 0; memset(operand, 0, 1); printf("%s", operand); … | |
Hi I have to write program that finds a solution how to put 12 knights to a 8x8 chess board that every square would be dominated by one of the 12 knights. Do you have any suggestions from where I can start? | |
Write a program that takes two input strings S1 and S2 and finds if S2 is a substring of S1 or not. If S2 is a substring of S1, the program should print the index at S1 at which there is a match. If S2 is not a substring of … | |
I wrote this code to find if string s2 is a substring of string s1. However I'm getting time limit exceeded. How can I make my algorithm better? #include<stdio.h> int main() { char s1[20], s2[20]; scanf("%s %s", s1,s2); char *p, *q, *count; p=s1; q=s2; int i=21; do{ if(*p==*q) /* the … | |
I'm using gcc compiler in linux ubuntu os. I's started doing windows programming in c but my compiler does not having windows.h or supporting header files. How can i include these windows programm supporting files? Can i download them externally or what else.......? | |
when converting iget erros especially in the cin parts because they are automatically passed by something #include<iostream> #include<conio.h> #include<math.h> using namespace std; int p=1; class Bank { public: char name[50],address[90],type; double ein_betrag, aus_betrag; double balance; int costumernr, accountnr, birth, tel; public: void newcostumer(); void newaccount(); void costumerdel(); void accountdel(); void … | |
How can one code a function to remove all trailing blanks from the right end of a string, assuming i use void trimRight(char a[]); | |
I am having problem getting the final result here, it keeps on looping. #include<stdio.h> #include<string.h> #include<conio.h> #include<math.h> #include<stdlib.h> #include<ctype.h> int main() { int i, t, k, max, min, sumof; printf("Enter number of integer elements in array: "); scanf("%d",&t); int a[t]; printf("Enter list of array: \n"); for ( i = 0; … | |
Write a program that reads an MxN matrix A and prints its elements in spiral order. You should start from the element in the 0th row and 0th column in the matrix and proceed in a spiral order as shown below. 1→ 2→3→ 4 ↓ 5→ 6→ 7 8 ↑ … | |
The greatest common divisor of integers x and y is the largest integer that evenly divides both x and y. Write a recursive method Gcd that returns the greatest common divisor of x and y. The Gcd of x and y is defined recursively as follows: If y is equal … | |
#include<stdlib.h> #include<stdio.h> #include<string.h> struct D { char name[20]; float balance; }d; struct C { char name[20]; int count; }c; char ch; struct A { char command[20]; char name[20]; char filename[25]; float amount; }a; struct P { char name[20]; }p; int main(char argc, char**argv) { struct A b; char str[100]; FILE … | |
Hi. I found this code online: #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <sys/uio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> /*********************************************************************** * Global Constants * ********************************************************************/ #define A_ROW 2 #define A_COL 3 #define B_ROW 3 #define B_COL 2 #define ARGUMENT_COUNT 13 #define PIPE_QTY 4 /*********************************************************************** * Global Variables … | |
#include<stdio.h> #include <file.h> main(int argc, char *argv[]) { FILE *fp; char s[100]; int i; //char exit if((fp=fopen("Allah ya isa.mp3","rb"))==NULL) //Open file and read on binary mode { printf("Could not open the file\n"); // exit(1); } fclose(fp); } #include<stdio.h>`` main(int argc, char *argv[]) { FILE *fp; char s[100]; int i; //char … | |
guys Im a newbie here I really need your help for our project...pls help me..heres the problem..Write a C program that add a names into a file then read the names in a file and sort it alphabetically..(FILEPOINTER). | |
Hi, my requirement is that I do gets and take user name as input. Now I have to create a file name with the same name as user name. Next if I try to login as a same user from different client I need to check if that file with … | |
#include<stdio.h> #include<stdlib.h> int main() { int i,j; int ascii_value; char c; FILE *plain; plain=fopen("xx.dat","r"); while((c=getc(plain))!=EOF) { ascii_value=c; printf("%d %c\n",ascii_value,c); printf("~~~~~~~~~~~~~~~~~~~~\n"); } fclose(plain); return 0; } the file xx.dat is 12sdfsldkfj MY output is 49 1 ~~~~~~~~~~~~~~~~~~~~ 50 2 ~~~~~~~~~~~~~~~~~~~~ 115 s ~~~~~~~~~~~~~~~~~~~~ 100 d ~~~~~~~~~~~~~~~~~~~~ 102 f ~~~~~~~~~~~~~~~~~~~~ 115 s … | |
#include<stdio.h> #include<stdlib.h> int main() { int i,j; int ascii_value; char c; FILE *plain; plain=fopen("xx.dat","r"); while((c=getc(plain))!=EOF) { ascii_value=c; printf("%d %c\n",ascii_value,c); printf("~~~~~~~~~~~~~~~~~~~~\n"); } fclose(plain); return 0; } the file xx.dat is 12sdfsldkfj MY output is 49 1 ~~~~~~~~~~~~~~~~~~~~ 50 2 ~~~~~~~~~~~~~~~~~~~~ 115 s ~~~~~~~~~~~~~~~~~~~~ 100 d ~~~~~~~~~~~~~~~~~~~~ 102 f ~~~~~~~~~~~~~~~~~~~~ 115 s … | |
A company provides his staff 20% off for tour allowance of basic his basic salary and 10% off for housing rent allowance.calculate the salary in unsigned int. | |
I am working on a Texas Instrument's Board which has MSP430f47197 and the has the following code (C files). The current resolution for kWhs is .01 but I need higher than this. I changed the code to some extent but unfortunately I could not hit it to what I need! … | |
Hello! I would like to ask you for help about this: Create a program in C that inputs a random number from the keyboard( long long ), finds the sum of the numbers formed by the digits, grouped in pairs starting from the one and displays the character equivalent of … |
The End.