15,551 Topics
| |
I'm testing this sample fast food chain program and my problem is every time I select the order the resulting price is like Php895764796364227741000000000000000.0000 Here's the code: [CODE] #include<stdio.h> main() { int choice; float TP; clrscr(); printf("Welcome to Greenwich!\n\n"); printf("This is our menu:\n"); printf("1. Overloaded Pizzas\n"); printf("2. Extreme Cheese Overload\n"); … | |
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 … | |
[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] | |
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"; … | |
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 . … | |
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 - … | |
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 | |
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); } … | |
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 … | |
why we need to avoid using scanf to read a character???? can anyone explain it clearly?? | |
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! | |
plz help to prepare for adobe. from where should i prepare. if anyone have appeared fo adobe ... | |
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... | |
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); … | |
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 … | |
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 … | |
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= … | |
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++ | |
printf("Input an integer"); scanf("%d",&int); i want my int to accept integer only.. how can i do that? tnx in advance :) | |
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; … | |
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 … | |
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 … | |
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..... | |
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? | |
[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 … | |
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 … | |
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 … | |
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 … | |
[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; } … |
The End.