15,552 Topics
| |
HI I want to write a class that it gets two decimal numbers and add them without using decimal expression like double and float . for example 12/05 + 1/98 =14.3 How can I do so ? thanks | |
Question 1: [CODE]main() {int i=-3,j=2,k=0,m; m=++i||++j&&++k; printf("\n%d%d%d%d",i,j,k,m); } [/CODE] ans is -2201 how? Question 2: [CODE]main() { int a,b; a=sumdig(123); b=sumdig(123); printf("\n%d%d",a,b); } sumdig(int s) { static int s=0; int d; if (n!=0) { d=n%10; n=(n-d)/10; s=s+d; sumdig(n); } else return(s); } [/CODE] please explain the ans | |
Can someone please explain the meaning of these return 1 vs return 0 vs break. I know 1 generally means true and 0 generally means false but how would they effect a return statement? Also when would you wanna use a return statement instead of a break statement and vice … | |
Hello all, When I try to compile a small program I am getting an error that I do not quite understand. I get this error: media_tracker1.c: In function 'add': media_tracker1.c:152: error: expected expression before ';' token when I try to compile this code: [CODE= "c"] #include <stdio.h> #include <stdlib.h> #define … | |
hi, I have a problem with BST. For example after the insertions of below numbers, 23 1 45 2 3 5 52 234 31 The output should be like this way: [B]23[/B] [B][/B][B]1,45[/B] [B][/B][B]-,2 | 31,52[/B] [B][/B][B]-,- | -,3 | -,- | -,234[/B] [B][/B][B]-,- | -,- | -,- | -,5 … | |
Hello guys. I am working on the code below. I am trying to create my own shell. The code compiles without errors, but when I execute it though it doesn't output anything. I have tried it with /bin/ls as input and it doesn't work. Any suggestions? [code=c]#include <stdio.h> #include <stdlib.h> … | |
Hi frenz, the above code runs perfect. But while printing the arrays x y z the value of y[0]changes...could u plz help me in sorting this problem.. thank u.. this is the output.. [B]x y z[/B] 1 -1 0 2 4 -2 3 3 0 4 2 2 5 1 … | |
| Hi guys, I have a txt file in which each line contains information in following format: VELOCITY<100.0> LAT_1<N 00 00.0000> LON_1<E 000 00.0000> SIMULATE<false> I would like to write a C or C++ programm to select only the values of the words I need. I need those values to do … |
I have been trying to check Internet connection but all ways I have tried have failed. Some example code would be great, or the package to use. Thanks very much. | |
Please, I have tried everything that I can learn from a book...any help with this problem is greatly appreciated. I've spent days writing and modifying and I am just lost now. Is there anybody that can help me solve this question using C language? You are developing a database of … | |
Hi, I am required to first read a number, n and then n lines of string. The strings can contain leading spaces which has to be preserved: 2 " hello world" ... using [CODE]scanf("%d", &n); for (int i = 0;i < n;i++) { scanf(" [^\n]", message); .... printf("Case #%d: %d\n",case_count, … | |
i need a c programme that reads a txt that you chosse then count the number of each word in the programme i have e.g. "hello this word is very funny this is not" hello 1 this 2 word 1 is 2 very 1 funny 1 not 1 i would … | |
Why the output is 100? [CODE]#define f(g,g2) g##g2 int main() { int var12=100; printf("%d",f(var,12)); return(0); }[/CODE] | |
I'm curious why all the events code and autogenerated code when controls are added to the form are written to the form1.h instead of the form1.cpp. Is this a configuration item? This defeats the purpose of information hiding by separating the declaration from the implementation. | |
hello . I have a problem. I have a variable DWORD num= 0x1234ABCD i want to convert it to char * for example- char * result[0]= '[the ASCII of 0x1]' result[1]= '[the ASCII of 0x2] result[2]='[the ASCII of 0x3] ... How can i do this?? thank you very much! | |
I am almost completely brand new to programming (been in my first programming class for about a month), and I am trying to learn stuff that my professor isn't teaching yet so that I don't get behind later, and I am doing this by writing simply programs and learning all … | |
Can some one please help me in writing a program for the INSERT AND DELETE operation on a BST, the operation functions must be NON-RECURSIVE ?? | |
Hi, I am trying to understand the Standard C function "getchar()". I am using CodeBlocks 8.02 in Windows XP. Please compile this code in your compiler and note how it behaves: [CODE]#include<stdio.h> int main() { int i=getchar(); while(i!=9) { printf("%d",i); i=getchar(); } printf("%d",i); return 0; }[/CODE] When I insert Tab, … | |
ok I'm taking a text file.. 16 lines.. 6 character values per line and trying to randomly get one character per each line.. and place them into a 2d array (4x4). The values i'm getting aren't correct for some reason.. anyone have any helpful tips? [CODE] int main() { srand … | |
Hi All, Today I came across a peculiar piece of code. [code] int main(int argc, char* argv[]) { printf("%lf\n",(0.99-0.90-0.09)); } [/code] According to me the output for this code should be 0, but to my surprise when I ran this code the answer that I got was -0.000. I cannot … | |
hello, Here's a simple question I want to clear up. We all know that we can use the name of an array as the pointer to that array, and that a pointer holds the address to the variable named. What I'm doing is this [CODE] //somwhere in the code uint8_t … | |
Hi to everyone here! I'm a newbie! I just wanna ask help from you especially from the administrator regarding my machine problem..... I am asked by my proffesor to create a slot machine program. This is how it goes... The simulation starts by presenting the player with a menu of … | |
Can you please give me a list of all of the % letters that go with int, floats, and doubles in printf and scanf. | |
i need help about the String codes.... its about how to delete a string.. like for example it displays like "The Dogs and Cats" the program wants the user to choose what to delete like i want to delete the Dogs.... and the result is now "The and Cats" cause … | |
i am getting linking errors while i try to program graphics in turbo c "unable to open file tcclass.lib"please help | |
Im trying to make a program that will sort the the list according to its cost...from least to expensive... here's my code: [CODE]#include <stdio.h> #include <string.h> typedef struct resto RESTO; struct resto{ char *name; char *address; float cost; char *food; }; void output(RESTO r1); int main() { RESTO r1= {"Coras","Agora",60,"BBQ"}; … | |
I'm trying to convert a double w/ a string of characters w/o using sprintf and padding w/ 0's.. omg... driving me nutz.. what I have thus far.. [CODE]#include <iostream> #include <cstdlib> #include <cmath> #include <deque> using namespace std; void d2s(double,char[], unsigned int); int main() { while (true) { double num; … | |
i'm doing a payroll system and i have finished it but i need some eror checking reports for name and integer but i'm going to do the integer first which wll input hours of a day from monday to friday what i need is a loop along with error checking … | |
I have to lines listed.. a cin >> x and a scanf("%f",&x). If I use cin program works perfectly.. change it to scanf and values arent' even corect any longer.. different decimal values all together.. anyone??? [CODE] #include <iostream> #include <cstdlib> #include <cmath> using namespace std; double ApproxCos(double,double); int main() … | |
i have a problem with this code iv been try lots of expressions to show elven thousand to nineteen thousand and nothing seems to be can you guys help me out tnx in advance [code] #include<stdio.h> int main() { int n,teens,thousands,hundreds,tens,ones,tthousands; printf("Enter a number: "); scanf("%d", &n); tthousands=n/10000; n=n%10000; thousands=n/1000; … |
The End.