19,876 Topics

Member Avatar for
Member Avatar for hellsae69

Can anybody help me on how to search a keyword in my text file. I read about eliza420 Thread but still don't get it. If i have a text file named. "animals.txt" with a content of, ------------------------------------------------------------------- Fish Pig Dog Goat Bird ------------------------------------------------------------------- and in my c++ program a question …

Member Avatar for thekashyap
0
80
Member Avatar for ndeniche

Hi... I have been trying to figure this out, but it has been an impossible task 4 me...:rolleyes: this is a gasoline pump counter, and i have developed an infinite cycle to print the gas counter and the cash counter...:mrgreen: the problem is, i need a stopper for the cycle, …

Member Avatar for thekashyap
0
397
Member Avatar for amt_muk

Hello Friends, Suppose I have a function like - [code] void myFunc( char* str) { ....... ....... } [/code] And I have to pass a pointer of type "const char*" into that function. Now my question is that can I pass the pointer like following way (ie by custing it …

Member Avatar for amt_muk
0
203
Member Avatar for h_howee

I'm working on a "breakout" game and everything worked fine until i tried to add in double buffering. I tried to take out double buffering since i couldn't get it to work and now, it draws everything from the top left corner of the screen instead of in the client …

Member Avatar for h_howee
0
125
Member Avatar for potato_bum

hi im asked to read data inputs from a text file in c. my problem is i dont know to separate the values, ex. may data contains these: 1.00:2.00:3.00 i would like to assign the values a = 1:00, b = 2.00, c =3.00. how is it done? thanks!

Member Avatar for Ancient Dragon
0
110
Member Avatar for RisTar

Hi, im trying to create a program that will control a dynamic array . The program have few functions to handle dynamic array. * Add number to array * Erase number from array * Print the array I have two problems with my code . The first one is with …

Member Avatar for thekashyap
0
175
Member Avatar for fatboysudsy

hi all, I have been struggling for a while with my client/server program. I have to authenticate in order to log on correctly. I have managed to get most things sorted, asking for username ( which is a long integer (12) ) and also and customer ID (also an int …

Member Avatar for Ancient Dragon
0
114
Member Avatar for virus.exe

I was wondering if it possbile to C++ creat a croaahair, or a dot in the center of my screen. The dot would have to run on top of all the windows I open. lol my friend wanted me to make him a crosshair for counter-strike. thx guys, if this …

Member Avatar for ~s.o.s~
0
112
Member Avatar for Sabi_146

Write a complete program to implement the link list operations as following. a. Write a routine to make two lists L1 and L2 with 5 elements given by the user at run time. Or add two lists with its elements in the main function. b. Write a routine to compute …

Member Avatar for ~s.o.s~
0
87
Member Avatar for hbk619

I got this code (written when sleepy, sorry for lack of "expertness") [CODE]#include <stdio.h> #include<time.h> int card1; int card2; int card3; int total; int other; srand(time(NULL)); card1=(rand()%22)+1; card2=(rand()%22)+1; other=(rand()%22)+1; total=card1+card2; int main() { printf("Hey, welcome to HBK's Twist or bust game. Lets begin\n"); printf("Your cards are: %d and %d\n", card1, …

Member Avatar for hbk619
0
2K
Member Avatar for rwagnes

I am writing a short program in c on a linux platform which takes an argument from the command line. My only problem is retrieving that argument. It is an integer. Here's what is currently in my code: int seconds = *argv[0]; Thanks :cheesy: EDIT: Here is the rest of …

Member Avatar for rwagnes
0
169
Member Avatar for kirogthar

Firstly hello every1 this site helped me a lot with my ANSI C learning program... I am currently working on an homework about Binary sum, I explored the website and saw the binary - decimal conversion codes and they helped me a lot. But i seem like can't write the …

Member Avatar for Ancient Dragon
0
36
Member Avatar for RisTar
Member Avatar for Ancient Dragon
0
62
Member Avatar for mrjoli021

I have a function that returns an int. How can I call it from the main function.

Member Avatar for mrjoli021
0
89
Member Avatar for roby4eldiablo

Hi all, please help me. How to create makefile with target? my question is this: I have a file named "server.c" and must create a makefile for compile it in "cygwin" and in "solaris". the tag for the compilation in cygwin are: - Wall - DTRACE - g the tag …

Member Avatar for Ancient Dragon
0
77
Member Avatar for grunge man

um something i have been wondering for a long time is. how do u make it so the user inputs a word and the program identifies the word as a number so like if someone typed the word frog and it reconized it as the number 5.

Member Avatar for grunge man
0
126
Member Avatar for grunge man

um latly i have ben seeing stuff like bla_bla_bla in tutorials and stuff and im just trying to figure out what this "_" character is supost to mean could any one help me?

Member Avatar for grunge man
0
123
Member Avatar for iqbal

i am just start Computer grahics. that is my first program please help me [code=c] #include <GL/glut.h> void DrawPixels(); void OurPixelsDrawingFunction(); void SetView(); void SetView(int w, int h) { glViewport(0,0,w,h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); } void DrawPixels() { glClearColor(1.0,1.0,1.0,0); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); gluOrtho2D (0.0,600.0,0.0,600.0); OurPixelsDrawingFunction(); void OurPixelsDrawingFuntion() { glColor3f(0,1,0); /*Set …

Member Avatar for John A
0
123
Member Avatar for aPPmaSTer

Hey everyone! I've been trying for a couple of days now to make a function and it's driving me crazy. I need a function that takes a set of numbers in an array, for example: int array[]={4,3,5,7} and produce another array with all possible combinations of those numbers, or just …

Member Avatar for aPPmaSTer
0
110
Member Avatar for JadedTortoise

[B]Question:[/B]I ran into a point where it would be very helpful to send a function a portion of an array, instead of the entire thing. Now i can think of a couple work arounds like sending the whole array and a begin number, and range number, then computing off of …

Member Avatar for WaltP
0
186
Member Avatar for semmem1

I am trying to return an array of integers from a method into an array in my main. I know that you cannot pass an array in C, but you can pass a pointer to the array. My problem is though that every time I pass the pointer, I seem …

Member Avatar for semmem1
0
94
Member Avatar for alt234

I'm trying to write a recursive merge sort on a linked list. I'm basically stuck on the split portion of it currently. I came up with a solution quite similar to many other solutions I've found on the web. Many people say it works but so far my solution doesn't …

Member Avatar for thinkfast
0
121
Member Avatar for roby4eldiablo

[CODE]servaddr.sin_port = htons(ADD_PORT); Bind (listenfd, (SA*) &servaddr, sizeof(servaddr)); Listen (listenfd, LISTENQ); #ifdef TRACE err_msg ("(%s) info - socket created, port number= %ld, child number= %ld, waiting for connections ...\n", prog, ADD_PORT, child_n); #endif /* viene detto a signal come reagire se arriva il segnale SIGCHLD, cioè avvia sigchld_h*/ signal (SIGCHLD, …

Member Avatar for thekashyap
0
70
Member Avatar for IwalkAlone

Q.Write a function to accept a main string, one search string and one replace string. Replace the first occurence of search string in main string by replace string{assume the length of search and replace string is same). Solution I tried [CODE] #include<stdio.h> #include<conio.h> void main() { char mai[80],search[40],replace[40]; int i,j,k,l; …

Member Avatar for John A
0
127
Member Avatar for Colin Mac

I used what's below to delete a directory. It only deletes the directory if it's empty. How could I delete a directory and it's contents? [code] #include <unistd.h> int main() { rmdir("C:\\haha"); return 0; } [/code]

Member Avatar for Colin Mac
0
101
Member Avatar for Nholdamek

I've been building this program to interface with the Swis ephemeris library. It's working beautifully, except for one thing. OK, I need to be able to specify it to retrieve information about multiple planets, such as longitude, speed, etc. So I have a function that parses the command line parameter …

Member Avatar for Nholdamek
0
292
Member Avatar for gamodg

[code=cplusplus] #include<stdio.h> #include<conio.h> #include<fstream.h> void file() { for(int i=0;i<30;i++) { char a[10]="2-2aa.pak"; a[4]=a[4]+i%26; a[3]=a[3]+((i/26)%26); fstream file; file.open(a,ios::in |ios::out); file<<"anshulgarg"; file.close(); } } void main() { file(); } [/code] it creates 30 files with new names in bin but when i give relative path ex "\\p\\2-2aa.pak" and adjust a[8],a[9] appropriately it …

Member Avatar for Salem
0
83
Member Avatar for jivosan

Sorry for the nubbish question , but I'm wondering which function will do the trick-read a char from keyboard without need to press "Enter"???

Member Avatar for Salem
0
166
Member Avatar for jhdobbins

Okay, thanks ahead of time for looking at this. First off the program is in C, not C++. I am trying to read in from a text file... a certain question.... but i fairly suck at programming in C. I have a file pointer set up and i have it …

Member Avatar for JeganathanK
0
147
Member Avatar for gamodg

[color=#3333FF]presenting here a program fragement of my project two files mainn.txt mp.txt format i have given at the end of this code the problem is that while printing mp.txt the output is not in format as i expected [/color] [code] [color=#33CC00]DF: 1 SA: 2-2 DA: R1 D: 3 SA: R1 …

Member Avatar for GreenDay2001
0
76
Member Avatar for mrjoli021

i have a string array and I need to change it to uppercase. what function can I use??

Member Avatar for mrjoli021
0
77
Member Avatar for potato_bum

for example.. number.txt: (has these contents) 1.75:2.00:3.00 2.00:5.00:7.24 3.00:6.35:1.00 -- my source code is.. [code=c] #include <stdio.h> int main() { FILE *infile; double a, b, c; char d; double sum; infile = fopen("number.txt", "r"); if(infile == NULL) { printf("number DOES NOT EXISTS!"); } else { while(!foef(infile)) /*here's my problem*/ { …

Member Avatar for Aia
0
5K
Member Avatar for Monyet

Hi, it is pretty much my fault for procrastinating, anyhow.. I need to get the best grip for this language in about 2 weeks using Microsoft Visual Studio 2005 Professional. I need to get comfortable with both, I have experienced with Java but still pretty much new... I know objects, …

Member Avatar for percent20
0
117
Member Avatar for potato_bum

for example.. number.txt: (has these contents) 1.75:2.00:3.00 2.00:5.00:7.24 3.00:6.35:1.00 -- my source code is.. #include <stdio.h> int main() { FILE *infile; double a, b, c; char d; double sum; infile = fopen("number.txt", "r"); if(infile == NULL) { printf("number DOES NOT EXISTS!"); } else { while(!foef(infile)) /*here's my problem*/ { fscanf(infile, …

Member Avatar for thekashyap
0
1K
Member Avatar for shrikant telkar
Member Avatar for thekashyap
0
59
Member Avatar for roby4eldiablo

Hi all, someone can tell me where i can find an example of this kind of signal handler? i try to use fenv.h but on cygwin doesn't work (cygwin don't have it) and this program must run on cygwin and on solaris. i try also with SIGFPE, but when i …

Member Avatar for roby4eldiablo
0
98
Member Avatar for notfornothing21

What does the identifier [COLOR=navy]"[B]break[/B]"[/COLOR] mean and how would it be used? Thanks.

Member Avatar for John A
0
126
Member Avatar for endsamsara

Hi, I'd like to know how the following program work. [CODE] #include "stdio.h" #include "stdlib.h" #include "conio.h" #include "graphics.h" #include "dos.h" void iniciar_grafica(); void graficar_datos(); void graficar_vectores(); int procesos[4][5]={1,8,2,4,6, 2,3,8,9,6, 0,1,2,3,4, 0,0,0,0,0},procesos_ejecutados[5]; int cpu=5,uso_cpu,mayor,prioridad,i,midx,midy,pid=4,j; char num[10],c; int main(void) { clrscr(); iniciar_grafica(); midx=getmaxx()/2; midy=getmaxy()/2; while(1){ for(j=0;j<5;j++){ graficar_vectores(); graficar_datos(); cleardevice(); } printf("Si …

0
74
Member Avatar for ideas-adv

Develop a[COLOR=red] C program[/COLOR] that has a structure for a list of students that has the array of students and the number of students. The structure for each[COLOR=red] student[/COLOR] consists of [COLOR=blue]ID number, name, GPA, number of courses, and a list of courses[/COLOR]. The structure for each [COLOR=red]course[/COLOR] consists of …

Member Avatar for ideas-adv
0
104
Member Avatar for IwalkAlone

Q.Write a function to accept 20 characters and display whether each character input is a digit, lower case letter or upper case letter. Solution I tried [code=c] #include<stdio.h> #include<conio.h> int main() { char inp; int i; clrscr(); for(i=0;i<20;i++) { printf("Enter a character\n"); scanf("%c",&inp); if(inp>='0'&& inp<='9') { printf("It is a digit\n"); …

Member Avatar for FoX_
0
76
Member Avatar for nuw_gamnera

hey, i got a c project to be done n that is about a flight reservation system so i want help from u to do my codings..... i plan to create two file pointers and make 2 txt files namely Flight details and reservation details plz send me some Turbo …

Member Avatar for Ancient Dragon
-1
124
Member Avatar for jigoro

is there a way to convert everything i input to my program into its ascii binary equivalent? if so please show me; thanks.

Member Avatar for FoX_
0
83
Member Avatar for disc

I'm trying to retrieve the name of the computer that my programm is running on. This is the code: [code] TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1]; DWORD cnt = MAX_COMPUTERNAME_LENGTH + 1; std::string name = [COLOR=#800000]""[/COLOR]; [COLOR=#0000ff] if[/COLOR]( GetComputerName( compName, &cnt) ) { name = compName; } [COLOR=#0000ff] return[/COLOR] name; [/code] The …

Member Avatar for disc
0
106
Member Avatar for sbenware

I'm having a problem with my search function for my linked list. It has to do with my foodItem object. I'm not sure what to replace it with since it's part of the function protocol. The previous version of this [URL="http://www.daniweb.com/techtalkforums/thread72745.html#"]code[/URL] used an array and part of my problem is …

Member Avatar for nottoshabi
0
179
Member Avatar for Jasy

Can any one please help me i have been working on this program since morning but couldnot figure it out.....pls... the program reads an input file and counts the frequency of characters in it i.e. how many times each character occuring. i know how to read from an input file …

Member Avatar for Lerner
0
122
Member Avatar for Savage221

I'm having some trouble keeping this array in bounds. I have a 10x10 array that I print out on screen. I call a function that changes the center value [5][5] and the values below/to the right/left of this center value. [i][j+1] [i-1][j+1], etc.. So the values constantly change and constantly …

Member Avatar for thekashyap
0
91
Member Avatar for addicted

Hey, There are somethings i dont understand in classes, for example let us examine this : we created a class Employee , with private data members firstName, lastName and monthlySalary; we have some functions that performs operations like a constructor, set and get functions on this data members. Now! we …

Member Avatar for ~s.o.s~
0
116
Member Avatar for MIGSoft

Hey everybody, Could somebody please provide an example for using the STL find_if for the following task. I am trying to search a vector of structs, using the following criteria: compare whether the key of the struct in the vector matches the key of another struct (instace of the same …

Member Avatar for vijayan121
0
182
Member Avatar for gpta_varun

Hi All .. consider the case : [code] class test { public : int a; test(); } class test_derv : public test { public: int a; }; void main() { test * pctest = new test_derv; delete pctest; } [/code] We have implicit destructors defined , when their actual definition …

Member Avatar for John A
0
89
Member Avatar for endsamsara

Hi, well i'm a program that has to show 3 rectangles and a menu (which will add data and then show in the rectangles) to simulate a processor but i´m getting a problem when the program runs, it shows the rectangles and a the menu right, but when i use …

Member Avatar for endsamsara
0
92

The End.