19,876 Topics

Member Avatar for
Member Avatar for cookiedianne760

[code=c] #include<stdio.h> #include<conio.h> #include<string.h> struct book{ char title[30]; int book_isbn[13]; };book library int x, found,count,y; char title[20][30]; void setup() { strcpy(title[0], "Wind In The Willows"); strcpy(title[1], "Fright Night"); strcpy(title[2], "Women From Venus, Men are from Mars"); strcpy(title[3], "Happy Days"); strcpy(title[4], "Gone Fishing"); strcpy(title[5], "My Sql"); strcpy(title[6], "About Nothing"); strcpy(title[7], "Beowulf"); …

Member Avatar for jephthah
0
121
Member Avatar for scarface3288

This is the file I will be calling from, basically it stores something into a file called "temp.txt, so let's assume that it works and the problem is not here. This is the "file.h" file. [CODE]#include <iostream.h> #include <fstream.h> #include <string.h> #include <stdlib.h> ofstream output_file("temp.txt", ios::out); class NUM_STUD: { public: …

Member Avatar for scarface3288
0
102
Member Avatar for nagaa

Hi, pls help me to understand the fork process and execlp command.. With one perfect small example is ok. for me.. I can abe to understand theoritically buit i can't able to proceed through practically.. Pls no the needful..

Member Avatar for Salem
0
74
Member Avatar for profesa23

im a new member who is a junior technician, my c: & d: have dissapeared under my computer and i have already scanned for viruses with karspersky and no viruses where found, the only way i can access the drives is through disc management or creating short cuts on the …

Member Avatar for thunderstorm98
0
87
Member Avatar for nnobakht

hey guys, im have written a code that all it does is get user input and run a simple fork task. the problem i am running is the commands i type for example /bin/ls and so on does nothin it jsut asks for the next input. Could someone give me …

Member Avatar for Luckychap
-1
692
Member Avatar for Prabakar

I happened to try find the total number of ways a horse can cover all 64 squares in a chess board without visiting a square more than once starting from one corner. All I was able to do was to use a brute force algorithm which run for a whole …

Member Avatar for Prabakar
0
189
Member Avatar for hapiscrap

C++ program in Bloodshed Dev C++, I was told by the compiler log that I have 1 error and I cant figure it out! [code] #include <iostream.h> int main () { int employeeid; int hoursworked; float hourlyrate, grosspay, taxamount, netpay; float const TAXRATE = 0.10; cout << "Enter The Employee …

Member Avatar for Nick Evan
0
123
Member Avatar for riahc3

Hey everyone. Glad to become part of this community and I hope I continue to come here for a long time seeing as this site gives great helps. My problem: I have a struct that is (for example) the following: [code] #define NUM 999 struct client { int id; char …

Member Avatar for Clockowl
0
181
Member Avatar for Aleczz

I have a debug assertion failed problem with akrip code. That code is downloadable from [url]http://akrip.sourceforge.net/simple.c[/url] I have add a new code to function RipAudio(...) where i want to add new folder and name the file to it. [code] void RipAudio( HCDROM hCD, DWORD dwStart, DWORD dwLen, int song ) …

Member Avatar for Aleczz
0
314
Member Avatar for toolbox03
Member Avatar for jephthah
0
232
Member Avatar for hapiscrap

Bloodshed dev c++, recieved 1 error on line 24 (return 0), here is the error.... Compiler: Default compiler Executing g++.exe... g++.exe "C:\Dev-Cpp\payroll.cpp" -o "C:\Dev-Cpp\payroll.exe" -g3 -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -g3 C:\Dev-Cpp\payroll.cpp: In function `int main()': C:\Dev-Cpp\payroll.cpp:24: error: expected `;' before "return" here is input........ Execution terminated [code] #include …

Member Avatar for Salem
0
348
Member Avatar for virtual_friend

[[U]I][B]My Doubly linked list doesnt work when i try to display using backward/reverse traversal... Will you please help me....[/B][/I][/U] [IMG]http://www.withfriendship.com/user/images/616/1vijay.jpg[/IMG]

Member Avatar for mitrmkar
0
76
Member Avatar for Google Spider

Hi, [URL="http://www.webinmind.net/bpc.html#two"][U][COLOR="Red"]Someone told me to use this code to clear the input buffer..[/COLOR][/U] [/URL] [code]while((ch=getchar())!='\n' && ch !=EOF);[/code] But I fail to understand how it actually works. For example, there are two newline characters in the buffer [quote] [B][U]This is my buffer[/U][/B] \n \n [/quote] Now getchar() grabs the first …

Member Avatar for Narue
0
129
Member Avatar for ohhmygod

[CODE=c] #include <stdio.h> #define M 21 #define N 2 #define INPUTFILE "C:\\Documents and Settings\\Duy Anh Bui\\My Documents\\Uni Stuff\\Eng Computing\\Sourcecodes\\Exercise 2\\in.dat" #define ARRAYFILE "C:\\Documents and Settings\\Duy Anh Bui\\My Documents\\Uni Stuff\\Eng Computing\\Sourcecodes\\Exercise 2\\array.dat" float Quadratic(float,float,float); //Quadratic Function Prototype int main () // Start main() { float a[M][N] = {0}; // Array a …

Member Avatar for Ancient Dragon
0
194
Member Avatar for n.aggel

hi guys, it's been a while since i used c for anything so here goes a question tha may seem silly. I have 2 variable length arrays.... [code=c] int main() { int n = 5; int m = 6; int before[n][m]; int after[n][m]; array_function( 5, 6, before, after ); } …

Member Avatar for n.aggel
0
379
Member Avatar for l1985

Hi there I'm having a problem with gcc The code compiles just fine ,but it doesn't run I have a printf next to main but it doesn't even do that The code is supposed to be an http server ,implemented using Berkeley sockets ,but that doesn't really i just want …

Member Avatar for Salem
1
102
Member Avatar for kashi_787

I want to read file in binary mode using fread() into structure members. following is the code which works perfectly on Turbo C compiler(DOS base) but doesn't work for VC++ 6, it is giving exception at fread() statement. The input to this file we can give any .bmp file name …

Member Avatar for jephthah
0
146
Member Avatar for chazzquire

Hello, I'm trying to use getch several times in my program, but it is remembering earlier key presses. Is there a function or command I can use to clear the getch buffer? Or am is there something else I am doing wrong? Thank you. C.

Member Avatar for chazzquire
0
159
Member Avatar for Clockowl

hai. I'm trying to compile a program split up across multiple files. The code is far from complete, but I noticed lots of compiler warnings and errors. This ought to be due to splitting the code up: I thought the preprocessor simply copy and pasted the code into main.c when …

Member Avatar for Clockowl
0
127
Member Avatar for agabriel

Hello, Okay I'm stumped and can't figure out why this code chunk isn't working properly (works on square matrixs; everything else doesn't work).... uint8 * imageTranspose( uint8 *im ){ uint8 *im_transpose; int x, y, org_offset, tran_offset; int im_size = dims[0] * dims[1]; if ( (im_transpose = malloc(sizeof(uint16) * im_size)) == …

Member Avatar for Clockowl
0
3K
Member Avatar for xyster

I have a quick question that is been bugging me. [CODE]void swap(void *a, void *b) { void *tmp; tmp = a; a = b; b = tmp; }[/CODE] I wrote this intending it to be either able to swap a structure, or just the data defined within a structure. Will …

Member Avatar for xyster
0
103
Member Avatar for spirals

Not certain if this is the right place to ask this. I need to get two processes to use the same data. Process 1 reads text files, parses them and creates linked lists (structures).before this process terminates it display all the lists to prove the data has been loaded correctly. …

Member Avatar for spirals
0
108
Member Avatar for Sephy

So basically i got to make program where you can add rows, inside those rows numbers and count in each row and all rows pair number sum. This far im done and everything is working. Now part which don't want work. I need make option to make rows longer or …

Member Avatar for Duoas
0
112
Member Avatar for sjinadasa

Hi, This is my first post in this forum and it is a 'help me' post :) Anyway, I took a beginners class in C Programming and at the completion of the class we were assigned to do a project. The project is designing a billing system for a supermarket. …

Member Avatar for jephthah
0
107
Member Avatar for monstro

Given all that I hear about the problems with global variables, is it possible to declare a windows CRITICAL_SECTION object as a member of a base class that will not be created for each derived class? I want to implement an instance counter that is threadsafe, so I thought about …

Member Avatar for monstro
0
199
Member Avatar for nony0905

[code]#include<stdio.h> #include<conio.h> #define MAX_ROWS 10 #define MAX_COLS 10 void add(int a[][MAX_COLS], int b[][MAX_COLS], int result[][MAX_COLS]); void displayValues(int(*)[MAX_COLS]); void diff(int a[][MAX_COLS], int b[][MAX_COLS], int result[][MAX_COLS]); void main() { int val; int i,j; int choice; int cols,rows; int operation; int table1[MAX_ROWS][MAX_COLS]; int table2[MAX_ROWS][MAX_COLS]; int result[MAX_ROWS][MAX_COLS]; clrscr(); printf("Press 1 to enter values for …

Member Avatar for Prabakar
0
145
Member Avatar for InfinityArc

hi i am trying to make a function for calculating the commercial boat fee, so if a boat is commercial, the program will add additional fee to the total sum, and if its not it won't add anything to it. i got the function to run, but all i am …

Member Avatar for InfinityArc
0
133
Member Avatar for gps

Hi everyone I'm new to c++. Some one told me that to know c++ one needs to know how it memory works but It made no sense to me when browsing the long codes froms the expects. Can anyone please advise me with steps to follow to learn c++ quick. …

Member Avatar for Sky Diploma
0
51
Member Avatar for twgood

I have an assignment on currency I turned it in, and it is not right by no menas. I had no loops in any module, can anyone explain how to do a loop?

Member Avatar for allen.jes
0
118
Member Avatar for web_master

[CODE] #include<stdio.h> int main() { int i ,j ,a[5]; for(i=0;i<=4;i++) { printf("\n\tEnter the %dst value of the array: ", i+1); scanf("%d", &a[i]); } j = a[0]; printf("\n\tOriginal array entered by the user: "); for(i=0;i<=4;i++) { printf(" %d ", a[i]); if(a[i]<a[i+1]) { j = a[i+1]; } } printf("\n\n\tGreatest no. from the …

Member Avatar for varsha0702
0
98
Member Avatar for SonxQ7

Hi all, i'm using Visual Studio 2005 and by mistake enable the arrows which represents tabs and dots with represents spaces when coding... How do i disable this?

Member Avatar for SonxQ7
0
77
Member Avatar for twgood

I am wodering if i answered these correctly or not? Algorithm Verification Consider the following selection statement where X is an integer test score between 0 and 100. input X if (0 <= X and X < 49) output "you fail" else if (50 <= X and X < 70) …

Member Avatar for jephthah
0
204
Member Avatar for kv79

Hi all I am using Dev-C++ . I want , when I press Tab to skip a 3 blank places instead 6 . Thank you for your effort of reading .

Member Avatar for kv79
0
99
Member Avatar for emilio

i'm trying to get random numbers in a loop like this [CODE=syntax]#include <stdio.h> #include <time.h> int getRand ( int a , int b ) { return a+rand()%(b-a+1); } int main() { srand ( time( NULL ) ) ; int i; for(i=0 ; i<6 ; i++) printf("%d\n",getRand(0,9)); return 0; }[/CODE] the …

Member Avatar for emilio
0
118
Member Avatar for ohhmygod

I got this code here, i wonder why it doesnt put in the file "in.dat" in the same folder. [CODE] #include <stdio.h> #include <stdlib.h> #define N 20 //Number of trials void main(void) { FILE * pFile; float data[N][2]; int i,j ; char overwrite; for(i=0;i <= N ; i++) /* Initinalize …

Member Avatar for Ancient Dragon
0
231
Member Avatar for BigFormat

I have to pass a string to a function that strcats something to it, in K&R I read to pass a pointer to it, but I don't know where to allocate buffer... Is there a difference betw passing an empty string or not? My printf starts with some strange symbols, …

Member Avatar for BigFormat
0
2K
Member Avatar for InfernalDrake

Maybe my question is odd, or maybe already answered, but i didn't knew another way of searching a solution (the title i selected may get an idea of how weird is it) Its quite simple, i'm creating an application that has a command prompt, this is, like ms-dos the C:\>_ …

Member Avatar for InfernalDrake
0
79
Member Avatar for toolbox03
Member Avatar for jephthah
0
99
Member Avatar for Onixtender

Hi, I've have a problem of printing data from stack, if it's simple words,then stack works just fine,but if I try to push changed data using function(Written by a very intelligent moderator :) ), I get just the same word n times: Intelect Intelect Intelect .... [code] #include<stdio.h> #include<stdlib.h> #include …

Member Avatar for Onixtender
0
182
Member Avatar for nagaa
Member Avatar for Ancient Dragon
0
136
Member Avatar for xyster

Hello all, I have been a member here for some time, i must admit this is my first post. I have read the posting rules, lets hope my title is considered "meaningful". i have no code snippet, yet. I have just hit a sudden wall in my heap programming. I …

Member Avatar for xyster
0
101
Member Avatar for qurat

[B][COLOR=navy]hi my name is qurat .. i have a small problem :rolleyes: i dunno how to do this program .. i have tried it several timez but it is giving some or the other error[/COLOR][/B] [B][COLOR=#000080]here it is:[/COLOR][/B] [B][COLOR=#000080][/COLOR][/B] [COLOR=#000000]Implement a Queue using two Stacks (implement Stack using link list).[/COLOR] …

Member Avatar for Prabakar
0
85
Member Avatar for RyanLeaf

Hello, I am currently learning (or really just begun) Assembly (my first programming language, by the way) and am wondering once I become somewhat good at Assembly, should I start picking up the C language. I know that several languages are based upon it, and I am even planning on …

Member Avatar for Colin Mac
0
359
Member Avatar for nagaa

Hi, I want to do the following steps one by one 1. check whether given file is exists in the directory or not 2. if exists open the file 3.read the first line and store the values 4. got to the last line of file and store the values 5. …

Member Avatar for Clockowl
0
78
Member Avatar for satanix

hello i have got little problem :) create a c program which starts with 3 processes the first proccess generates 50 random numbers and writes them inti common memory. the second proccess reads them and whrites the even numbers in file A,the odd numbers in file B. [CODE]#include <stdlib.h> #include …

Member Avatar for satanix
0
107
Member Avatar for twgood

I am wondering about this if I had a program that contained this: if (0 <= X and X < 49) output "you fail" What will be printed if the input is 0? would it say you fail? I was thinking it was worded wrong and it should read:if (0 …

Member Avatar for twgood
0
69
Member Avatar for Spagett912

I'm trying to translate the following code from C++ into Asembly language but am having trouble. I know that I have to make a cmp and one or more jmp. If any1 has sugguestions or tips thats great. Here's the C++ coding: [CODE] int x = 1 * 2; int …

Member Avatar for Spagett912
0
248
Member Avatar for harsh2327

I want to read files and folder names from directories. I have used the following code. But the problem is that in the output the file name gets truncated.[I](See the output below)[/I] [code=C++] #include <dirent.h> #include <stdio.h> #include<conio.h> void main(void) { clrscr(); DIR *d; struct dirent *dir; d = opendir("."); …

Member Avatar for harsh2327
2
297
Member Avatar for knapshots

To whoever is using the following code for timing code execution in C Originally Posted by [[B]B]vijayan121 [/B][/B] [code=c] #include<time.h> blah blah main() { clock_t start, end; double cpu_time_used; start = clock(); /* whatever */ end = clock(); cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC; } [/code] if you …

Member Avatar for Ancient Dragon
0
76
Member Avatar for wam2

I have written a code for maximum power point tracking. The purpose was to create DLL file and use it in a circuit base simulation program. I used Microsoft visual c++ 2008 express and created that DLL file but I only get first value from the created array in C. …

Member Avatar for wam2
0
378

The End.