15,550 Topics

Member Avatar for
Member Avatar for saravinuya

Can someone help me with my program. I have the code but there are some logical errors. The program should contain 100 numbers that have a menu, first the user should input a number then the menu will show: 1. it adds again a number, 2. it displays all the …

Member Avatar for dev90
0
312
Member Avatar for compzets

[CODE]#include<stdio.h> int main() { int n,i,c=0; printf("\nEnter a no:"); scanf("%d",&n); for(i=1;i<n;i++) { if(n%i==0) { c=c+i; } } if(n==c) printf("\nPerfect no."); else printf("\nNot a perfect no."); }[/CODE]

Member Avatar for cse.avinash
0
191
Member Avatar for guidely

Hi, I have problem passing array from main to another function Here is my code [CODE] #include <stdio.h> #include <string.h> # define Line_size 200 int processing(int lineCount, char harbour[Line_size][Line_size]) { int i; for(i=0;i<lineCount;i++) { printf("%s", harbour[i]); } } int main ( void ) { static const char filename[] = "data.txt"; …

Member Avatar for guidely
0
284
Member Avatar for virendra_sharma

Hi frnz , i need a code for 2^n and suppose user enter n = 4 , so the output will be 16 . Now whatever output we will get i need sum of numbers in that output e.g here we have 16 i.e 1 + 6 = 7 . …

Member Avatar for Mouche
0
134
Member Avatar for vedro-compota

Hi there) Guys , as I understand - this is c++ code = [CODE]int WINAPI WinMain(HINSTANCE hInst,HINSTANCE,LPSTR,int ss) { /* создаем и регистрируем класс главного окна */ WNDCLASS wc; wc.style=0; wc.lpfnWndProc=MainWinProc; wc.cbClsExtra=wc.cbWndExtra=0; wc.hInstance=hInst; wc.hIcon=NULL; wc.hCursor=NULL; wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName=NULL; wc.lpszClassName="Example 4 MainWnd Class"; if (!RegisterClass(&wc)) return FALSE;[/CODE] but tell me please - …

Member Avatar for vedro-compota
0
334
Member Avatar for guidely

Hi, How to read line by line of text file and store to array C data.txt example [CODE] 1234 25500 24000 1 1345 23523 21209 5 9865 12389 600 98 .... [/CODE] and sorted in order by last column I try everything and it not working Thank

Member Avatar for D33wakar
0
15K
Member Avatar for Ich bin würdig

Can someone please check my syntax? Thanks. The program runs but the output has some kind of error. Thanks. [CODE] #include<stdio.h> #include<conio.h> #include<string.h> void Pig_Latin_Converter() { char str[50]; char nv[50]="yay"; char c[50]="ay"; char key[]="aeiou"; char keys[]="bcdfghjklmnpqrstvwxyz"; char test[20]; char *p=str; scanf("%s",str); { p=strpbrk(str,key); if(str!=p) { strcat(str,nv); printf("Output: %s", str); } …

Member Avatar for YAMNA MIDHAT
0
187
Member Avatar for adot76

I am having a problem and hopefully you guys can help me out.. I need to count the frequency of a character in a string(option 5 in the program. I can do this part however i cannot get my program to count anything that is in uppercase. It only does …

Member Avatar for Narue
0
209
Member Avatar for Leaningnew

why we need to avoid using scanf to read a character???? can anyone explain it clearly??

Member Avatar for cse.avinash
0
105
Member Avatar for daianahoney

Hello. I am wondering how to split a string lets say char *a="raining apples training away" using a delimiter like "g a" and the result will be: rainin pples trainin way I tried using strstr but I got stuck. Any hints will be greatly appreciated. Thank you in advance!

Member Avatar for daianahoney
0
3K
Member Avatar for sydsine

plz help to prepare for adobe. from where should i prepare. if anyone have appeared fo adobe ...

Member Avatar for Narue
0
250
Member Avatar for Panathinaikos22

C/C++ have Datagridview-Listview-Calend and all those controls? i think c/c++ have only simple controls like msgbox/textbox/&button i have spend lot of hours to find something for win32 but nothing... exist smthing or i must draw byself :-s thats crazy...

Member Avatar for Moschops
0
129
Member Avatar for Shodow

help how to count the remaining letters from the similar.. Example.. carl, 2 barbie, 4 [CODE]#include<iostream.h> #include<string.h> #include<conio.h> #include<stdio.h> int findSimilar(char[],char[]); void checkValue(int,int); int main(){ char boy[50]; char girl[50]; int similarInBoy=0; int similarInGirl=0; int total; clrscr(); printf("Enter Boy's Name: "); gets(boy); fflush(stdin); printf("Enter Girl's Name: "); gets(girl); fflush(stdin); similarInBoy=findSimilar(boy,girl); similarInGirl=findSimilar(girl,boy); …

Member Avatar for Tess James
0
117
Member Avatar for Briinaa

Hello fellow members of daniweb, I've been rattling my brain for some time now on how to use a number code of sorts to output the name of a person, sort of like a id system. I'd really appreciate if someone or anyone could help me with this predicament. Thank …

Member Avatar for WaltP
0
132
Member Avatar for Alvi89

Hi, im very new to programming so i need some help. Im currently trying to read the memory directly using pointers, for example 23 stored in the memory for a float variable is: 41b80000 is there any way i can directly read this value from the memory and store it …

Member Avatar for Panathinaikos22
0
137
Member Avatar for Leaningnew
Member Avatar for Narue
0
86
Member Avatar for CD1

Hello, I have a problem with the atan2 function. I have 2 programs, one in C and one in Matlab. Both have an identical implementation. My problem is that I am getting occasionally different values from the atan2 function in C and Matlab. For instance: x=0.29695007709080329 y= -0.96764419257510348 Matlab atan2= …

Member Avatar for CD1
0
214
Member Avatar for Panathinaikos22

Hi, i use visual studio and i want to know how i can create c projects, there is no any option for c, only for C++

Member Avatar for Narue
0
158
Member Avatar for b3ginn3r

printf("Input an integer"); scanf("%d",&int); i want my int to accept integer only.. how can i do that? tnx in advance :)

Member Avatar for Narue
0
11K
Member Avatar for programing

hi my program should implement queue using stack h make a code but i still have error if an one can tell me what is he error [CODE]#include<stdio.h> #include<conio.h> #include<process.h> int in_top=-1; int out_top=-1; void in_stack_push(int item); int in_stack_pop(); void out_stack_push(); int out_stack_pop(); int insert_queue[20],delete_queue[20]; void main() { int i,ch,item; …

Member Avatar for trin12345
0
175
Member Avatar for coding101

Im rewriting an "ls" command to show my directories in one color and files in another for easy notice..currently my stat calls are failing, and I dont know why? [CODE] #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <sys/stat.h> #include <sys/types.h> #define TRUE 1 #define FALSE 0 …

Member Avatar for Mouche
0
128
Member Avatar for guidely

Hi, I have a bit of problem to store array from text file, It compile but result is not correct. it will store array when Max Capacity of ship is greater than harbour capacity here is my code [CODE] #include <stdio.h> int loadShip(void) { FILE *fp, *fp1; //char filename; int …

Member Avatar for guidely
0
400
Member Avatar for Majestics

How can we access hard disk addresses from c language, accessing ram address is easy? Also can we access MBR of NTFS through c , just a bit dissusion required for starting my work? Thank You All in Advance.....

Member Avatar for nezachem
0
259
Member Avatar for geeksforgeek

explain the output:-- [CODE] int main(void) { int a=10,b; a=a+b-(b=a); printf("%d",a); } [/CODE] I am not understanding it. the precedence of bracket() is greater so b is assigned to a so expression becomes- a=a+a-a which should be equal to a but it is not why?

Member Avatar for geeksforgeek
0
201
Member Avatar for Master Mascus

[CODE]#include <stdio.h> #include <stdlib.h> int twento(void); int main(int argc, char *argv[]) { int number1,number2,sum1=0,sum2=0; do{ printf("Player 1 you start to play:\n"); number1=twento(); sum1 = number1 + sum1; printf("Player1 Your sum is %d\n",sum1); printf("Player2 Your turn to play:\n"); number2=twento(); sum2=number2+sum2; printf("Player2 Your sum is: %d\n",sum2); if (sum1==21)printf("\nPlayer1 You win"); else if(sum2==21)printf("Player2 …

Member Avatar for foreshadowed
0
103
Member Avatar for cesione

I want to write a program to count the number of occurances of a substring in a main string. am having trouble with this please i need help. my code is below, you can show be a better way to write it and tell me were i went wrong. am …

Member Avatar for cesione
0
217
Member Avatar for geeksforgeek

hello daniweb.. can any one please explain me the following code:- [CODE] #include<stdio.h> int main(){ char far *p =(char far *)0x55550005; char far *q =(char far *)0x53332225; *p = 80; (*p)++; printf("%d",*q); return 0; } [/CODE] as per my knowledge far * is not used now.. but far pointer is …

Member Avatar for geeksforgeek
0
77
Member Avatar for DmytriE

Hi everyone! In class we just learned about pointers and the their uses. We have been given a project where we need to allocate dynamic memory for any number of matrices (up to four). All four of the matrices addresses are stored in a matrix poiner. All of this must …

0
76
Member Avatar for swissknife007

[CODE]#include<stdio.h> #include<conio.h> ins(int tree[15],int n,int item) {int ptr,par=0; printf("\nitem here is%d \t\n",item); n=n+1; ptr=n; while(ptr>1) {par=ptr/2; if(item<=tree[par]) {tree[ptr]=item;return;} tree[ptr]=tree[par]; ptr=par; } tree[1]=item; return; } del(int tree[15] ,int n,int item) {int last,right,left,ptr=0; item=tree[1]; last=tree[n]; ptr=1;left=2;right=3; while(right<=n) { if(last>=tree[ptr]) { tree[ptr]=last; return; } if(tree[right]<=tree[left]) { tree[ptr]=tree[left];ptr=left;} else{tree[ptr]=tree[right];ptr=right;} left=2*ptr;right=left+1; } if(left==n&&last<tree[left]) {ptr=left; } …

Member Avatar for swissknife007
0
155
Member Avatar for falakistan

hello everyone, i an new in daniweb and i want to know that how to generate random numbers in c without using pre-defined functions........... i can not use any predifined function...........it should b totaly our logic to generate random numbers........... please help me out........... i dont know c.........although i know …

Member Avatar for Narue
0
45

The End.