15,552 Topics
| |
[CODE]#include<stdio.h> #include<conio.h> #define m 5 void main() { int sal[m],cl[m],i=0,j; int a1=0,a2=0,b1=0,b2=0,split; float gi[m]; clrscr(); printf("\nEnter salary and class for 5 people,Class '1'for risk,'0'for no risk:"); for(;i<m;i++) { printf("\nEnter Salary:"); scanf("%d",&sal[i]); printf("\nEnter Class:"); scanf("%d",&cl[i]); } for(;i<m;i++) { split=sal[i]; for(j=0;j<m;j++) { if(sal[j]<=split && cl[j]==1) a1++; else if(sal[j]<=split && cl[j]==0) b1++; else … | |
hi . can someone plz explain how to do regex in C. input: a text file. aim: read each line from the text & check if a RegEx pattern exists. finally return that pattern if it exists. plz share any algo or code snippets if u have.thx. | |
The following program is supposed to sort eight strings in alphabetical order, but its not functioning properly. Can anyone please debug this [CODE]void main() { char *p[8], *s; int i,j,t; clrscr(); printf("Enter the strings:\n"); for(i=0;i<8;i++) gets(p[i]); for(i=0;i<8;i++) { for(j=i+1;j<8;j++) { t=strcmp(p[i],p[j]); if(t>0) { s=p[i]; p[i]=p[j]; p[j]=s; } } } printf("\nSorted … | |
Hi everyone, i need to generate random numbers between two values a & b, where both a and b less than 1. Example a random number between a = 0.60 and b = 0.69. what i am trying to do is in C program temp_ins = a + (drand48())*(b - … | |
Hello every1 My name as you know is displayed out.I am a CS student and we have mini-project assigned to every1 in my class. I have finished around 50% of my project.I need help.. My question: I want to take input from the web page,do the calculation in background (in … | |
Hello sir, Good afternoon! i am happy to get the help from you. for that thanku very much. but now i need help in the for loop. * * * * * * * * * * * * * * * here is the picture, i want the coding … | |
plz explain these function. how can w divide a number by 3 using only atoi function. | |
Hi, I dont know why I am getting segmentation fault when adding the line 'int n' [CODE] #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) { char* pStr; // no memory allocation int n; printf("enter a string\n"); fgets(pStr,20,stdin); printf("\nvalue of string is %s\n",pStr); while(*pStr!='\0') { printf("value of … | |
Hey guys i got a question to solve, can anyone help me out.. Write a C interactive program that will encode a word or sentence entered by a user. The encryption will be done as follows: For any word or sentence (note: blank spaces, special characters are ignored here, i.e … | |
[CODE]struct NUMBERS { char name[MAXCHARS]; struct NUMBERS *value; };[/CODE] i am new to programming ...can anyone explain this for me ? | |
I need help! In this program, if you hit the ENTER KEY the program will display the word "newline". If you hit the SPACE BAR it will display the word "spacebar". But unfortunately, the second statement did'nt worked (SPACE BAR). help me.... [CODE]#include<stdio.h> main() { char n; scanf("%c",&n); if(n='\n') printf("newline.."); … | |
Hi, I created a previous thread of re-sizing dynamic arrays. I got the answers to that question and I could re-size the dynamic arrays but when I tried to apply similar steps to creating a dynamic array of struct, my program compiles but crashes when i try to run it. … | |
I'm currently choosing which data structure to use for my data logging. Just want to ask for suggestion which type of data structure is better. It has limitation on memory either store in microcontroller RAM or SD card. - I can't know the total type of logging it has. (for … | |
Guys help me please, the equation on 2/3 is giving the waterTemp to 0; how come it is not changing? and also, if the nWaterTemp reached 20.00or somewhere 20.00 to 21.00; it is supposed to print that "THe kettle is now on "Help please [CODE]#include<stdio.h> #include<stdlib.h> #include<cstdlib> #include<time.h> void wait … | |
[CODE]#include<stdio.h> #include<stdio.h> #include<stdlib.h> struct bst { struct bst *left; int info; struct bst *right; }; struct bst root; void create(struct bst*,int); void preorder(struct bst*); void postorder(struct bst*); void del_leaf(); void del_singlechild(): void main() { struct bst *p; int n,c; char ch; root=(struct bst*)malloc(sizeof(struct bst)); printf("\nenter the info:"); scanf("%d",&root->info); root->left=root->right=NULL; do … | |
We are asked to input 10 integers where in we need to display: 1. The sum of all the odd numbers 2. The sum of all the even numbers I do not know how to make a statement and i do not know whether to use for or while and … | |
Hi, When i use realloc to re-size my array it is re-sizing it correctly but my some of my data is getting lost. Strange thing is that If I don't use realloc, I can still re-size my array by just increasing the index before inserting the data. In this case … | |
I am working on a "searching" program. But it always returns a "." as the up directory or whatever. And I can't do an if statement to check if its a period or not. The goal is to get the only name of the folder in that directory. There is … | |
Hello, I need to write code which detects whether keystrokes are injected by applications (with SendInput, keybd_event) or are genuinely coming from the keyboard. I came across a possible solution: creating a WH_KEYBOARD_LL hook and checking the INJECTED flag. So I've made this so far: [CODE] HHOOK g_hHook; LRESULT CALLBACK … | |
Write a C program to read Roll number,Name and Marks of 3 subjects of a student using structure | |
hi, u are so good at c, i saw some program that i looked for, but i dont look at result, i need a program, for beginner level of c programming (because i am beginner), converting binary to gray, gray to binary i only know while, if, for, a little … | |
I am a new c programmer . I want to know more about data structure . Expert programmer please reply. | |
I want to create a simple file....with the command Example: [CODE]touch file.txt[/CODE] ok its created *BUT* ****I want to edit this file in shell and save it, writing EOF to finish. Any suggestions? How i do that? Thanks! | |
I have a program that reads the data from a stream. Let's just pretend that I already made file in C:\ (record.txt) and I wrote the following words: hello world me you But the program will display in this manner: hello world me you instead of: hello world me you … | |
I'm stuck on this function that is related to the game of life. It is supposed to randomly populate the game board with '*'s based on the user input (what percentage they want to be '*'). this is what I have so far, but it crashes when I try to … | |
Hi everyone, I'm trying to store user input into an array. The output looks like this: Enter the size of the arrays: 5 Enter the cells of array1: 1 2 3 4 5 Enter the cells of array2: 5 4 3 2 1 This is my code so far: [CODE] … | |
I need help understanding the increment operator and the output of this program. I am confused with the output of 'i' and 'm' According to me: i = 4 and m = 20 but, that is not what you get when you compile. Please explain. Thanks in advance. [CODE]#include <stdio.h> … | |
Hello! I am fairly new to C, and trying to learn to deal with malloc. The objective for the code, is to allocate memory in order to store a string on the heap. Compiler says "Warning: assignment makes integer from pointer without a cast" "Warning: format '%s' expects type 'char … | |
I just want to ask.. How could I make the input (password) invisible? |
The End.