15,551 Topics
| |
How to write a program that asks the users to enter two integers, obtains the numbers from user, then prints the larger number followed by the words "is larger", if the numbers are equal, print the message "these are equal". use only the single-selection form of the if statement. | |
Mates, this is my first piece of C code. I do not know what is wrong. Please, tell me, that's not so I've highlighted the lines that the compiler "doesn't like " - [CODE]#include <stdio.h> #include <alloc.h> #include <stdlib.h> main() { short int n = 0; int k=0,u,i=0; char a=''; … | |
Hello. Im interested in learning something about allocating memory for a 2d array. So I have a function that does this, and it goes something like this : [CODE]short **g2D(short **arr,short row,short col) { short i; arr=malloc(row*sizeof*arr); if(!arr) { printf("\nMemory unavailable"); exit(EXIT_FAILURE); } for(i=MIN;i<row;i++) { arr[i]=malloc(col*sizeof*arr); if(!arr) { printf("\nMemory unavailable"); … | |
hey im new to daniweb, i recently wanted to revise a code for a dll but being as i dont really know c++ i turned to the help of daniweb if you would be so kind to assit me correct any problems with this code it would mean alot to … | |
[code] #include<stdio.h> #include<conio.h> void main(void) { int a1,a2,a3,a4,a5; clrscr(); scanf("%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5); printf("%d%d%d%d%d",a5,a4,a3,a2,a1); getch(); } [/code] | |
The Program is Addition of Large Integers.. Although This program is working But I want to know where i went wrong or what should i need to do to make it better.. [CODE] # include <stdio.h> # include <stdlib.h> # include <ctype.h> # include <string.h> typedef struct poly { int … | |
Write a c program that inputs the names of the 5 students and their marks in 5 course units. the program must calculate the average for each student. If the average of the students's marks is less than 50, then your program should print against the student the string"Sorry try … | |
Hey! We all learn file processing [ATTACH]18526[/ATTACH] I don't understand what is the difference between "for writing" and "for update". Could you please explain that? Thx so much! | |
[CODE]#include <stdio.h> #include <string.h> #include <stdlib.h> int getNumWords(char *name) { int i,numofwords=0; for(i=0;i<strlen(name);i++) { while (name[i]==' ') { i++; //pernaei ta kena osa k an einai. akoma k an einai stin arxi k sto telos } if (((i==0)&&(name[i]!=' '))||(i>=1)&&((name[i-1]==' ')&&(name[i]!=' ')&&(name[i]!='\0'))) { //i 1i sun8iki einai gt an to i … | |
i trying to to open a text-file in read mode and passing that file pointer to a function which will extract the text from that file pointer .... but every time i build and run the program i get the segmentation fault error at the start of the "loadtoFile" definition … | |
Hi, Trying to write some C code for an assignment using a PIC16F84 for a digital watch/alarm. RA0 to increment time RA1 to decrement time RA2 set-move to next digit RB7 set time/alarm RB6 enable/disable alarm 1. press RB7 once to set time. 2. press RA0 or RA1 repeatedly until … | |
i have creaed a loop that lets the user creates a file then copy a file to it and also allows the user to add more than 1 file to be copied. the problem that i found out is that when the progam goes back round the loop it drops … | |
How can i calculate the frame rate, CPU load, and execution time for my C coding? | |
i wann multiply two matrix but the part of given code is not working...i wanna input the value from the user using pointers.. [CODE]#include<stdio.h> #include<conio.h> void main() { printf("This is matrix multiplication program"); printf("\nEnter the dimensions of two array "); int Row1 = 0, Col1 = 0, Row2 = 0, … | |
I dont know what to do ADDING ELEMENT.first selection in the main menu....pls help me... A cluster is defined as a collection of different elements. A and B, including two sets of integer elements that are required for a program to perform certain procedures on the sets. To do this, … | |
I would like to know the exact difference between calloc and which is more useful?? Though calloc allocates memory in the form of blocks and malloc in a single block , do they both allocate memory continuously and if there is an obstacle , would calloc be able to jump … | |
i got this exercise and i wrote this code. [IMG]http://img42.imageshack.us/img42/8331/37255827.png[/IMG] i have a problem with the bubblesort part becouse it thinkes it's void pointer. i don't think i nedd to write the program 8 times there must be a way tnx a million [CODE]# include <fcntl.h> # include <stdio.h> # … | |
i have a problem with my coding to fing wether given string is palindrome or not without using strcmp(); and srtrev(); it returns "the string is not a palindrome " for all string the [CODE]#include<stdio.h> #include<string.h> void main() { int n,i,j; char a[100]; scanf("%s",a); n=strlen(a); printf("the length ia%s,%d\n",a,n); while(i<=j) { … | |
how to produce output without console window in c code? using dev c++ as compiler.say i have a prog. and it produces the output in console window as well as in text file. now i wan the output only in dat file not in console window. on executing the exe … | |
Hi All, I want a C programme which will take a user input as a date and number of days, and then it will add the given number of days to the input date and will give the resulted date. It should keep in mind all the permutation and combinations … | |
Let P1 and P2 are two polynominals.. where p1 = 1 + 4X^2 + x^4 and p2 = 2x^2 + x^4 program is to multiply p1 with p2 p3 = p1 * p2 Like line 1: ( 1 + 4x^2 + x^4) (2x^2 + x^4) line 2: 1*(2x^2 + x^4) … | |
please can anyone make a program in c language to convert a number from decimal to hexadecimal system using switch statements and please don't use arrays or %x | |
I want to know the procedure by which we can calculate time complexity of a C program. and how would we compare two algorithms. here are two sorting programs. how to compare both. [CODE] for(i = 0; i < n - 1; i++) for(j = i + 1; j < … | |
My code is giving a wrong output for the 3rd pair of vectors im finding the dot product of, although the first two are correct. (outputs - 0, 3, -3(should be 1))... I just cant find wahts wrong, i was guessing something to do with the -1 in the b … | |
Hi, well i take lots of time figuring this out. I need a program that tells me the coordinates of a word that is in other array, what I have gotten is the y coordinate "the column", but I need to do the case for a bidimentional array get the … | |
Hello, i am new in c programming it is just the second month i i deal with. I am really confusing about what i have to do with this exercise pls don't lough on me :( I hope for some help. That's what i have to do.. I have to … | |
Hi , I am trying to reverse a string using pointers.I am able to reverse a sting like this: My Reverse Program --> margorp esrever em But I want it word by word. Program Reverse My. [CODE] #include <stdio.h> #include <string.h> char str[50]="Reversing a string using XOR"; char strb[50]; char* … | |
I'm new to C programming and I am trying to write a simple ID3 tag editor for mp3s. An id3v1 tag is the last 128 bytes of the file, with 30 characters for the artist, 30, for the title, etc... So far I have written this program which saves each … | |
Hey guys, I have a question regarding this code I made some days ago.. (works fine) [CODE]#include <stdio.h> /*para printf(),scanf()*/ #include <conio.h> /*para getch(),clrscr()*/ #include <stdlib.h>/*para exit()*/ #include <math.h> //#include <dos.h> //#define NUMEL 20 double f(double x); void _error(int n); enum{INTERVALOS}; enum{SIMPSON1_3=1,SALIR}; int n; float a,b; //float X[NUMEL],Fx[NUMEL]; /*Metodo de … | |
Hi, I'm a beginner and just started Turbo C I wrote this program in the editor main() { float years, days; printf ("Please type your age in years:"); scanf ( "%f", &years); days = years * 365; printf ("You are%.1f days old.\n", days); } I then run the program and … |
The End.