15,550 Topics

Member Avatar for
Member Avatar for fab2

[ICODE]Hi, I have written the program below and the compiler is not giving any error message and when I run it, the first request for an enter is almost always followed by strange numbers,which I don't know where they come from[/ICODE] [CODE] #include<stdio.h> int main() { int value; int inputs; …

Member Avatar for anirudh33
0
109
Member Avatar for Snader

This code from C++ to Turbo C [ICODE]#include<stdio.h> #include<conio.h> public class Stack { private: int size; int top; int *values; public: Stack(int size) { this->size =size; values = new int [size]; top = -1; } void main() { Stack *myStack = new Stack(10); } }; [/ICODE] what will be its …

Member Avatar for stevanity
0
85
Member Avatar for sketchiii

Hello fellow c programmers( I made a "hello world" program so I'm a c programmer too :) ). Anyway I want to know if there is anyway to make a Dev C program perform an action if it is a certain day such as printing the schedule for the day …

Member Avatar for MosaicFuneral
0
385
Member Avatar for vineeshvs

[code] #include<stdio.h> #include<stdlib.h> #include<math.h> #define pi 3.14159265 int **transpose(int **x,int m,int n); int **matrix_mul(int **m1,int **m2,int r1,int c1,int r2,int c2 ); int **dc4(int **x,int nrows,int ncolumns); main() { printf("hi"); int nrows=80000,ncolumns=1,i,j,**x,**dc4_x,**ix,M=nrows,N=ncolumns; //memory allocation for x x = malloc(nrows * sizeof(int *)); if(x == NULL) { printf("out of memory\n"); return 0; …

Member Avatar for vineeshvs
0
107
Member Avatar for happygeek

Want to know how to fix an election without resorting to bribery and corruption? Ever thought about throwing some Return Oriented Programming into the voting equation? Ordinarily, the hacking into of an electronic voting machine might spark a little bit of interest if there were an election looming perhaps. That …

Member Avatar for MosaicFuneral
0
604
Member Avatar for Chinjoo

[CODE]#include<stdio.h> #include<conio.h> #include<math.h> void hanoi(int x, char from,char to,char aux) { if(x==1) { printf("Move Disk From %c to %c\n",from,to); } else { hanoi(x-1,from,aux,to); printf("Move Disk From %c to %c\n",from,to); hanoi(x-1,aux,to,from); } } void main() { int disk; int moves; clrscr(); printf("Enter the number of disks you want to play with:"); …

Member Avatar for yash00yash
0
478
Member Avatar for jordankaushik

Hi everyone I need a general formula that is used for finding the determinant value of a NxN matrix.. please help me out...........

Member Avatar for DavidB
0
63
Member Avatar for CB44

I have an assignment due tonight. I am in the hospital with kidney stones and in much pain! I brought my laptop but am kind of out of it. Could someone please help so I do not get a bad grade, please! This is for a module of an electrical …

Member Avatar for MosaicFuneral
0
132
Member Avatar for BLUEC0RE

Kind of programing in general question but I'm doing it in c so I'm posting in the c forum. My class is dealing with VCards and my prof talks about a process call "unfolding". I have no clue what this means so can anyone give a quick briefing or point …

Member Avatar for MosaicFuneral
0
74
Member Avatar for alexchen

I need to calculate the area of a triangle using this formula. What is wrong with my code? error C2063: 'p' : not a function [CODE]#include <stdio.h> void Area(int a, int b, int c) { int p = a * b * c; int area = (p(p - a)(p - …

Member Avatar for alexchen
0
113
Member Avatar for terabyte

I coded a simple program that pretends two users input random characters and the program tells you which user wrote what [CODE]#include <stdio.h> int main(void) { int x; char user; char ch; puts("type a character"); for(x = 0;x < 9; x++) { if(x%2 == 1) { user = 'x'; } …

Member Avatar for terabyte
0
101
Member Avatar for p0l4rb34r

I have posted in some other forums and im sorry for people who have already seen something like this from me, but i was hoping if i could get some different views and opinions. I have probably very bsic computer knowledge and no programming knowledge, however, i have recently took …

Member Avatar for asterix15
0
170
Member Avatar for Rass Saee

The following program compiles (using MS Visual Studio 2010) with no errors or warnings and runs without any error, why? Thanks in advance for explanation. [CODE]#include <stdio.h> int f[3] = { 1,2,3 }; int g[4] = { 12,45,55,65 }; int main(int argc, char *argv[]) { printf("%d\n", f[5]); return 0; } …

Member Avatar for asterix15
0
99
Member Avatar for preetip24

hi all..my project is to design a partial C compiler(output shud be d 8085 code).i an new to this..theoritically i hv read a lot bt practically i dont knw 4m where 2 start..i m using flex bt facing problems with dat even..can sumbdy provide guidance..i'll b grateful.thank u

Member Avatar for Narue
-1
43
Member Avatar for PCSAWICK829

Hello! So this is pathetically easy as programs go in the C language (i hope). I am working on a variation of the Hello World program (as I am just starting to learn C, solo). I am using the C All-in-One for dummies book, and I got a little ways …

Member Avatar for anirudh33
0
252
Member Avatar for alexchen

I am trying to print a rectangle using this symbol *. When I print it, it draws an L. What is wrong with my code? [CODE]#include <stdio.h> void rect(int base, int height) { int x = 0,y = 0; while(x < height) { x++; if(x == 1 || x == …

Member Avatar for alexchen
0
166
Member Avatar for vineeshvs

[CODE] #include<stdio.h> #include<stdlib.h> int **array(); main() { int **result=array(),i,j; //display result for(i=0;i<2;i++) printf("\n"); for(j=0;j<2;j++) printf("%d \t",result[i][j]); } //function int **array() { int nrows=2,ncolumns=2,i,j; // printf("hi"); //memory allocation int **array; array = malloc(nrows * sizeof(int *)); if(array == NULL) { printf("out of memory\n"); return 0; } //printf("hi"); for(i = 0; i …

Member Avatar for vineeshvs
0
246
Member Avatar for murtazamzk

[CODE]#include<stdio.h> #include<conio.h> #include<dos.h> #include<stdlib.h> void main() { clrscr(); while(!kbhit()) { struct time t; gettime(&t); textcolor(random(15)) ; gotoxy(23,3); printf("%d:%d:%0d",t.ti_hour,t.ti_min,t.ti_sec); sleep(1); clrscr(); } getch(); }[/CODE]

Member Avatar for death_oclock
-2
109
Member Avatar for shinsengumi

Hi everyone! I recently created a MySQL table that has three columns: (1) integer ID (2) integer num1 (3) integer num2 Now, I have a C program that waits for the user to input an integer ID and when there is an input, the corresponding num1 and num2 in the …

Member Avatar for smantscheff
0
326
Member Avatar for murtazamzk

[CODE]#include<graphics.h> #include<conio.h> #include<math.h> #include<dos.h> #include<stdio.h> void main() { int gd=DETECT,gm; int x=320,y=240,r=200,i,h,m,s,thetamin,thetasec; struct time t; char n[12][3]={"3","2","1","12","11","10","9","8","7","6","5","4"}; initgraph(&gd,&gm,"C:\\tc\\bgi");//ut the directory which containsegavga.bgi circle(x,y,210); setcolor(4); settextstyle(4,0,5); for(i=0;i<12;i++) { if(i!=3) outtextxy(x+(r-14)*cos(M_PI/6*i)-10,y-(r-14)*sin(M_PI/6*i)-26,n[i]); else outtextxy(x+(r-14)*cos(M_PI/6*i)-20,y-(r-14)*sin(M_PI/6*i)-26,n[i]); } gettime(&t); printf("The current time is: %2d:%02d:%02d.%02d",t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund); while(!kbhit()) { setcolor(5); setfillstyle(1,5); circle(x,y,10); floodfill(x,y,5); gettime(&t); if(t.ti_min!=m) { …

Member Avatar for murtazamzk
0
148
Member Avatar for Niai123

The following program reads a specified file that contains a list of numbers. The program then prints: Sum, sum of the sqaures Mean, mean of the squares Standard Deviation A table of every number in the file with its difference from the mean and the quantity. A second table printing …

Member Avatar for Ancient Dragon
0
104
Member Avatar for sh4rif

Hello everyone Thanks for viewing this topic for me.... my question is when I tried to check user inputs a valid age it works only if a number is entered. If by mistake user inputs a character value (e.g. any character a to z or any symbol) this loop runs …

Member Avatar for sh4rif
0
319
Member Avatar for fg_aa_c

Hi in my program there is an option to enter a directory as a command line argument. Is there any check I can perform to see whether this directory is relative to the current working directory? For example if we are /home/user and the user wants to input /home/user/folder they …

Member Avatar for Ancient Dragon
0
118
Member Avatar for CPT

so these are my structures: [CODE] struct information { int Id; char name[20]; }[/CODE] that structure I use in my tree structure [CODE] struct node{ information *employee; node *left,*right }[/CODE] and I have a generating function: [CODE] node* generate_tree_from_file(void) { node* tree=malloc(sizeof(node)); employee* emp=malloc(sizeof(employee)); int NoEmployees; FILE *input_file; input_file=fopen("emp.bin","r"); if(input_file) …

Member Avatar for nezachem
0
145
Member Avatar for protas

Hi there, Kindly see my attached code below. This is already running however, I do have a little problem with the WITHDRAWAL part. For example: My current balance is 500 and I withdraw 501. It will tell me at first that I have insufficient funds and would prompt me to …

Member Avatar for prushik
0
5K
Member Avatar for Joey_Brown

Hello I have a following line inside a .txt file This$is$my$Input$203 I would like to know whether is it possible only to store the 203 value in variable using fscanf. So without declaring char arrays to store all those strings. I was thinking of something like this ; [CODE]fscanf(fp,"%*[^$]$%*[^$]$%*[^$]$%*[^$]$%d",&number)[/CODE] But …

Member Avatar for Joey_Brown
0
108
Member Avatar for localp

I need to know how to work this out, say for example i have a method is C++ that is helloworld(), and i need to call it from a C program. [CODE] // in my C++ program void helloWorld(){ // some code; cout<<"hello world"; some code..... }[/CODE] [CODE]This is my …

Member Avatar for Narue
0
298
Member Avatar for localp

I need a method to invoke the ENTER key in the keyboard. I tried this; yet its for return and not ENTER [CODE]keybd_event(VK_RETURN,0x9c,0 , 0);[/CODE] All i want to do is, to press the keyboard key from the code. How do i do this?

Member Avatar for Narue
0
79
Member Avatar for lmytilin

[CODE]#include <stdio.h> #DEFINE suntetagmenes 3 double eswterikoginomeno(double dianusmata[][suntetagmenes]) { int j; double eswteriko=0; for (j=0;j<suntetagmenes;j++) { eswteriko+=dianusmata[0][j]*dianusmata[1][j]; } return(eswteriko); } double e3wterikoginomeno(double dianusmata[][suntetagmenes], int i) { double e3wteriko; if (i==0) { e3wteriko=dianusmata[0][1]*dianusmata[1][2]-dianusmata[0][2]*dianusmata[1][1]; } else if (i==1) { e3wteriko=dianusmata[0][2]*dianusmata[1][0]-dianusmata[0][0]*dianusmata[1][2]; } else { e3wteriko=dianusmata[0][0]*dianusmata[1][1]-dianusmata[0][1]*dianusmata[1][0]; } return(e3wteriko); } int main() { char x='m'; …

Member Avatar for lmytilin
0
133
Member Avatar for MarounMaroun

Hello guys, I have this function: [CODE=c] void swap(char **a, char **b) { char *tmp=*a; *a=*b; *b=tmp; } int main() { char *str1="aaa"; char *str2="bbb"; swap((char **)&str1, (char**)&str2); return 0; } [/code] The program runs and really swaps the two strings. I don't understand why we send (char**)&str1 and (char**)&str2 …

Member Avatar for Narue
0
138

The End.