- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
10 Posted Topics
You can set the precision of a number using sprintf: #include<stdio.h> #include<stdlib.h> int main(int argc, char** argv) { float nr1 = 0.0f; float nr2 = 0.0f; float sum = 0.0f; int n = 0; char buffer[30]; printf("Enter the two numbers:\n"); scanf("%f %f",&nr1,&nr2); printf("How many decimal places would you like your …
I would rather do it like this: #include<stdio.h> #include<stdlib.h> #define ROWS 5 #define COLUMNS 4 int main(int argc, char** argv) { int** array = NULL; int i = 0; /* Memory allocation */ array = (int**)malloc(sizeof(int) * ROWS); if(array == NULL) { perror("Not enough memory for matrix allocation"); } for(i=0; …
You could do the logical connections by using a graph structure: typedef struct { int id; /*An unique identifier for the gate*/ int type; /*Type of the gate : AND, OR, XOR, etc*/ int numberOfInputs; /*How many inputs you will use*/ LogicalGate *inputList; /*A pointer to an array of LogicalGate …
I personally think that low-level programming is the best thing to do when you're at the beginning of your career. When you get older, perhaps you will no longer enjoy time-consuming (but much needed) optimizations in C or Assembly and perhaps you will want to do high-level programming using RAD …
[QUOTE=SuchANewb;1730565]Yes, I know that now and that is why I'm asking for help...because I don't know how to code it in my case...it has been bugging me for a few days now and I really hope someone could help me :)[/QUOTE] Something similar to what you're asking was done in …
[QUOTE=c_learner;1731193]Dear All, I'm new to C, and would appreciate your help about the below code. The purpose of the program is to multiply the elements of the array and print the result. The user enters the value for how many elements he wants to have multiplied, and then the function …
[QUOTE=Vetha;1730672]Hello, Here I have a problem, I want to print the word after the Delimiters in a simple text file, but i cant able to do it also cant able to find a good example for that in a web. So please if anyone help for this.[/QUOTE] Check this out: …
[QUOTE=coding101;1723742]How do strings work? In C we must declare the size of a char array to represent a "string". But in java we do not allocate memory for the size of a string. So how does the string work? Is there a pre deterimed size assigned to strings from the …
Perhaps this might come in handy: [url]http://dystopiancode.blogspot.com/2011/12/simple-calculator-applet.htm[/url] (it's a calculator applet)
I know an assembly [URL="http://dystopiancode.blogspot.com/2011/12/implementing-strlen-in-asm-for-mcs-51.html"]quasi-implementation of strlen[/URL]. It was made for 8051 microcontrollers, but you may find the logic useful.
The End.
dheaven