19,876 Topics

Member Avatar for
Member Avatar for dotancohen

I just read in K&R that a function, even if not defined as void, need not return a value. To test I wrote a quick power function and I'm getting reproducible yet unexpected behaviour: [code]✈demios:cliC$ cat power.c #include <stdio.h> int power(int x, int y); int main() { printf("%d\n", power(2,5)); return …

Member Avatar for vegaseat
0
200
Member Avatar for phalaris_trip

I was trying to revise my linked list and implement it in C to check if there is a difference in performance... just as a sort of weird hobby.. In the absence of templates I'm trying to figure out how to pass a type as a parameter for this purpose. …

Member Avatar for MonsieurPointer
0
4K
Member Avatar for Dante2002

Hello all, I have put together an inventory program and having problems getting it to compile and run. I am at my wits end, with it. I'm not sure what it is that I'm missing. Any help would be greatly appreciated. Thanks in advance. [CODE] #include <iostream> #include <string> #include …

Member Avatar for fibbo
0
214
Member Avatar for evaldaskowka

Hello i want to get my computer time using c++ i googled, but i couldnt find anything that suits me... Time code should be able to use this function: if(hours == 10) { do something... } Can you help me? Thank you.

Member Avatar for Ancient Dragon
0
221
Member Avatar for mitrious

Here's my problem. I'm trying to write info to a bin file, consider the following piece of code: [CODE]FILE *fp = fopen("banco\\banco.bin", "ab"); char buffer[22]; sprintf(buffer, "55555555 111111 11111"); fwrite(buffer, sizeof(char), 22, fp); fclose(fp);[/CODE] when I run this it writes to the file that line twice when I print it …

Member Avatar for mitrious
0
148
Member Avatar for jmurph333

I am currently working on a game that takes place in the console. I need to know how to combine [CODE]Console.WriteLine()[/CODE] and [CODE]Console.ReadLine()[/CODE] into 1 line so that the blinking underscore appears on the same line. Is there any way to do this? Any help is appreciated.

Member Avatar for jmurph333
0
233
Member Avatar for manish250

hello all i have been writing the java code and new to C programing.I am very confused in point.i have the following code [CODE]#include<stdio.h> main() { int *ptr=50; printf("%d",*ptr); return 0; } ~ ~ [/CODE] why it is giving the segmentation fault.and when i print ptr then it gives value …

Member Avatar for bajishareef
0
144
Member Avatar for dilequeno

I have created a program that reads data from a file and stores it into a vector. The data looks something like the following: 48.698635 -0.000000 0.000019 1.000000 -0.004386 0.002192 // Step 1 48.583797 0.114838 0.100000 1.099997 -0.005061 0.001945 //Step 2 48.457909 0.125888 0.100000 1.199994 -0.005854 0.001883 //Step 3 ect... …

Member Avatar for L7Sqr
0
886
Member Avatar for darkdai

hey guys, i was wondering if it was possible to display something in a different language like Arabic or any other language in a printf() statement.

Member Avatar for Ancient Dragon
0
86
Member Avatar for liora

Hi! good morning! I am writing a program, that uses interaction between 5 processes(using signals), I am trying to use in one of them- gets command to get a command from the user. And it seems that gets isn't working.. Maybe one of the other processes interrupts the work of …

Member Avatar for Ancient Dragon
0
100
Member Avatar for Slavrix

hey ive mostley got this working however im not sure if im reading the binary file correctly because for some reason its playing up, anyone able to give it a look over ? also i know in my sort function, there is an issue with the comparing of the values …

Member Avatar for Slavrix
0
110
Member Avatar for siddiqui_1985

[code]#include<stdio.h> #include<conio.h> void main() { char gender,Mar_stat; int age; clrscr(); printf("Enter your Marital Status "ma" or "um":\n"); scanf("%c",&Mar_stat); if (Mar_stat == 'ma') { printf("Enter your Gender And Age :\n"); scanf("%c %d",&gender,&age); if (gender=='M' && age >= 30) { printf("You are Insured"); } else { printf("Sorry"); } getch(); } } [/code] …

Member Avatar for bajishareef
0
181
Member Avatar for pardhu463

Hi to all... I am getting a warning, i am trying to avoid that but its not sorted out..Please suggest me to avoid that warning. my code is as follows.. [CODE] const char var[][2][5]={ {"1.95","3.70"}, {"2.40","4.60"}, {"2.70","5.70"}, {"6.60","13.40"}, . . . . }; void fun(int col,int row,char *str) { ... …

Member Avatar for pardhu463
0
268
Member Avatar for campuzcrazyness

[code] #include <stdio.h> main() { int ctr, bin, quotient, deci=0, binary,octal,hexa; float rem; char mark_magic; clrscr(); do { clrscr(); quotient = 1; binary = 1; gotoxy(32,3); printf("-=< MAIN MENU >=-"); gotoxy(15,5); printf("from any Number System to Decimal System conversion"); gotoxy(5,6); printf("------------------------------------------------------------------------"); gotoxy(5,7); printf("------------------------------------------------------------------------"); gotoxy(26,9); printf("[A] Binary System"); gotoxy(26,11); printf("[B] Octal …

Member Avatar for campuzcrazyness
-1
553
Member Avatar for GregMalick

Here's the problem I'm trying to solve: I've written a DLL that's used as a plugin within another program. Within the DLL is a number of structure allocations which represent the positions of points in a mesh (over time). These allocations can be very very large. If another instance of …

Member Avatar for GregMalick
0
469
Member Avatar for kandarpa

Hi, I am allocating memory using [B]malloc()[/B] and then I am filling the aloocated memory with "0" using [B]memset()[/B]. The combination of [B]malloc()[/B] and [B]memset()[/B] are being called many times in my project. After adding memset() function affecting my project's performance. So I am searching for the alternative for the …

Member Avatar for N1GHTS
0
3K
Member Avatar for happyhappyhappy

[code] void generalboard(); void inputuser(int*pt1, int*pt2,int*pt3); void checkwins1d(int*A,int*B, char C[][3][3]); void checkwinsup(int*A,int*B,char C[][3][3]); void checkwins3D(int*A,int*B,char C[][3][3]); void inputcomputer(int*pt1,int*pt2,int*pt3,char A[][3][3]); void score (int a, int b); void displayboard(int a, int b, int c, int i, int j, int k, char board [][3][3]); int main () { int i,j,k,a,b,c,computerscore=0,userscore=0,counter=0; char board[3][3][3]; generalboard(); …

Member Avatar for Arbus
-1
147
Member Avatar for N1GHTS

I have been coding in C for a very long time, and I thought I had it all figured out, until I saw this code in an MD5 library: [code] static void MDPrint (mdContext) MD5_CTX *mdContext; { int i; for (i = 0; i < 16; i++) printf ("%02x", mdContext->digest[i]); …

Member Avatar for N1GHTS
0
205
Member Avatar for pardhu463

Hi to all, I am new to this forum..If i did any thing wrong in this thread please correct me... Let me tell you something about my project .... I am working on ARM7-LPC2148 processor with Graphical LCD. Now i am making a calculator which should be like as our …

Member Avatar for N1GHTS
0
202
Member Avatar for revjim44

I'm trying to understand the correct way to instantiate objects in C#, and I just can't seem to get it right. My code is in lines 17-37 lines 47-51 and lines 102-103 Any direction would be genuinely appreciated. Jim [CODE] private void findMortgagePayment() { string prompt; bool validPV = false; …

Member Avatar for ddanbe
0
182
Member Avatar for CeeGee

Hey all, i am a newbie at C# and need help with this program. This is what i have so far.The first part of the program work, but the second method InchesToFeetdoes not work. Please help. Due on Monday. Create a class named InchesToFeet. Its Main ( ) method holds …

Member Avatar for DaveAmour
0
895
Member Avatar for crapgarden

Can someone explain this excerpt from a book I'm studying: [CODE]char phrase[] = "Game Over!!!";[/CODE] [U]BOOK:[/U] [I]"C-style strings terminate with a character called the null character to signify their end. You can write the null character as ’\0’. I didn’t need to use the null character in the previous code …

Member Avatar for crapgarden
0
189
Member Avatar for Lilcrew

I need to make a SIMPLE BASIC program that plays crabs [code] #include<iostream> #include<string> #include<ctime> using namespace std; int main() { int money, i, wager, roll, roll1, roll2; string name; char bet, R; cout <<"Lets Play Craps!" << endl; cout << endl; cout <<"This program stimulates a session at a …

Member Avatar for NathanOliver
0
303
Member Avatar for localp

I have a Visual C++ console application (I am using windows Vista, Visual studio 2008). When executing the program i don't want to see the Console popping up. How do i code this. I tried simply removing all cout and printf statements but yet this didn't help. Need help here.

Member Avatar for Ancient Dragon
0
397
Member Avatar for perksexcuse

Hello DaniWeb! I've found your website very useful for previous problems in my course, but this time I've come across something I just can't figure out. I'm attempting to create a program thats instructions are defined in the code. I've used a previous post as a guideline, and it was …

Member Avatar for perksexcuse
0
154
Member Avatar for Lilcrew

I need to create a rectangle using for loop and a nested for loop So far the code I've got is: [code]#include<iostream> using namespace std; int main() { int row, i, width, spaces; cout <<"Enter the number of rows: "; cin >> row; cout <<"Enter the rectangle width: "; cin …

Member Avatar for mrnutty
0
137
Member Avatar for dina154

[CODE]// Randam Guessing Game #include <iostream> #define NEWLINE "\n\n\n" #include <cstdlib> // need to use rand() function #include <ctime> using namespace std; /*void Start(); void GetResult(); void HighScore(); int a, b, chance, maxrand; char difficultychoice, menuchoice, diffchoice; void Start() { a = 0; b = 0; chance = 0; maxrand …

Member Avatar for dina154
0
2K
Member Avatar for illIAm

Hi i got this progamm working fine it is supposed to read a comma delimited text file store as an array and the output a formatted version The problem is its outputting something really weird I dont know why. [B]The text file it is supposed to read[/B] [code=text]Darwin,3,33 Darwin,1,11 Darwin,6,66 …

Member Avatar for Narue
0
208
Member Avatar for Peter4n31

I am quite desperate about a random crash. The memory could not be "read" error. I would be very happy for any help. Thank you. [CODE]HRESULT CSceneNode::UpdateAll() { D3DXMATRIX backup_local_tm = ei.world_tm; Update(); SceneNodeIterator begin=FirstChild(); SceneNodeIterator end=LastChild(); for (;begin!=end;begin++) { (*begin)->UpdateAll(); // Here is the random Crash !!! } ei.world_tm …

Member Avatar for Peter4n31
0
192
Member Avatar for happyhappyhappy

Hey guys, I am interested into making a 3D tic tac toe game, but right now I am stuck. I created a 3D string... like board[3][3][3]. and each time the user type in numbers between 0 to 2...and the computer does the same too. I played a few 3dTTT game …

Member Avatar for Salem
0
154
Member Avatar for localp

I am new to C, hope someone could help me here. I need to implement a keystroke, for example, i need to programatically implement the 'return key'. As in if someone is pressing the 'return key' from the keyboard. but here, the user will not even touch the keyboard. the …

Member Avatar for localp
0
164
Member Avatar for Buffalo101

Hi, What's the best way of integrating a Paypal button in a WinForms application? I can make a tiny WebBrowser and render the form html in it, but when clicking it, processing should be done by the default browser, not the WebBrowser in my application. LEdit: Or I could just …

Member Avatar for Buffalo101
0
228
Member Avatar for SasseMan

Hello all! I'm having problems with running c++ on iOS. I have a iOS openGL project in Xcode 4 and an external library written in c++ that has to be a dependency to the iOS target so it can run on an Ipad. right now I'm testing with the iPad …

Member Avatar for SasseMan
0
105
Member Avatar for Nicco

Hi there, I'm working on a map for a class assignment and running into trouble. I've tried looking around the web but couldn't find anything that helped. I know how insertion works on a basic level when returning a node pointer but think i'm missing some key ideas when using …

Member Avatar for Nicco
0
2K
Member Avatar for metal_man

Hi to all. It's my first post here. I want to ask about 2D Gabor filter implementation. I have some code but it is not working. So let me present my work first: [code=c]signed int sumX, sumY; long int SUM = 0; int I = 0, J = 0; double …

Member Avatar for TrustyTony
0
491
Member Avatar for DOT6

Hello all, I have been working on a card game for the last month or so and sofar have created the basics ie. cards, deck... The language is ANSI-C and is created in programmers notepad with devkitpro and MLlib. Everything is working greate so far as in I can shuffle …

Member Avatar for Narue
0
256
Member Avatar for eaon21

i learned earlier how to move between two forms back and forth. but what if there are more forms? this is my code for form1: [CODE]Form2 form2 = new Form2(); private void aboutoldtrafford_MouseClick(object sender, MouseEventArgs e) { this.Hide(); form2.ShowDialog(); this.Show(); } [/CODE] when i click the button I can go …

Member Avatar for Bridgekeepers
0
2K
Member Avatar for rEhSi_123

Hi Guys, I am working on converting a console application into a user friendly GUI. The actual application is written in visual C++ and person has no information none what so ever on how to run it. So to understand the technique I am trying to experiment with the application. …

Member Avatar for JasonHippy
0
340
Member Avatar for super.mina

The user enters the following : " x+sin(x)-pow(x,2)+5log(x)" How can I make parsing for a statement like that .

Member Avatar for WaltP
1
131
Member Avatar for bufospro

Hi, I am trying to make a program which reads 6 integers , insert into a file numbers1.txt then copy numbers1.txt content to numbers2.txt and finally print numbers2. The problem I have is that when I am trying to copy the file to another the system crashes. My code is …

Member Avatar for WaltP
0
86
Member Avatar for apan

Is there a reliable method to extract the quantized DCT coefficients of a jpeg image? I can see that there is the jpeglib for manipulation of jpegs but I am wondering if someone has already used it and does the job I want to do. To extract the quantized DCT …

0
136
Member Avatar for fantasma

Greetings, I've got a working flex/bison parser that I would like to run from an exe file. However, I can't find the knowledge to achieve that. Do I need to create a C file, with an exec function to call the files? If so, what files do I call in …

Member Avatar for fantasma
0
313
Member Avatar for reza.adinata

Hi all, I am new in C programming, currently learning about linked list. I know that there is a lot of examples about linked list, but I decided to write my own code, to make me more understand. I managed to build a linked list, insert a new node after …

Member Avatar for reza.adinata
0
385
Member Avatar for Slavrix

hi can someone give this a quick look over and tell me where im going wrong [CODE]#include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> void main() { struct Rainfall{ char city[20]; int month; int rainfall; }; Rainfall Rainfallarray[18]; int count=0; FILE * readfile; readfile=fopen("CityRain.txt","r"); if(readfile==NULL) { printf("CityRain.txt failed to open."); exit(1); } printf("CityRain.txt Opened\n"); …

Member Avatar for Slavrix
0
128
Member Avatar for Nurder

Hello All, I've got a problem and I hope you'll help me, because I'm desperate. I've been finding everywhere on the websites, but I haven't found it yet :( .... I found this website [url]http://www.codeproject.com/KB/miscctrl/ClickAndDragPictureBox.aspx[/url] , where it the same function what I want to do it. I want to …

Member Avatar for ddanbe
0
126
Member Avatar for chhabraamit

HI, I am looking for faster input and output method for the C other than just normal scanf and printf modules. Please elaborate by simple example. thanks :)

Member Avatar for Narue
0
314
Member Avatar for Stefan_Lam88

Hi everyone. I have a few question to ask regarding email notification in c#. I have the following codes: [CODE] SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); message.To.Add("alex@hotmail.com"); message.To.Add("alex2@gmail.com"); message.Subject = "Test"; message.IsBodyHtml = true; message.Body = "<html><b>Hello World!</b></html>"; smtpClient.Send(message); [/CODE] While in my web.config I do …

Member Avatar for Stefan_Lam88
0
146
Member Avatar for captalex

i have written code to move a dot from on end of the lcd screen to the other end. [CODE] /*move dot across the creen with pixel increments of 10*/ for(x=10;x<120;x+=20) { Glcd_Dot(x,y,0); Glcd_Dot(x,y,1); Glcd_Fill(0); delay_ms(100); } [/CODE] i have seen examples in C, but this is on a 128x64 …

Member Avatar for andrewll2
0
520
Member Avatar for whitelite

i want to make rot13 encryption this program convert ascii code from a caracter, and work only with uppercase character (65-90) please help me [CODE]#include <stdio.h> #include <stdlib.h> #include <string.h> void rot13(const char *input); int main(void) { char *input; printf("Enter string (max. 255 characters) : "); gets(input); printf("\nConvert result %s …

Member Avatar for andrewll2
0
246
Member Avatar for LesterTheGreat

Your program will have a 3x3 array. The user will input the sum of each row and each column. Then the user will input 3 values and store them anywhere, or any location or index, temporarily in the array. Your program will supply the remaining six (6) values and determine …

Member Avatar for Schol-R-LEA
-1
239

The End.