19,876 Topics

Member Avatar for
Member Avatar for snedan

hi guys i need a little hint on how to break an integer into its component so if you have like 1567 i need to get 4 integers with 1,5,6,7. Thank you

Member Avatar for ~s.o.s~
0
100
Member Avatar for Juggler

I have a question about manipulating an array in C++. In my program, a cstring is entered. The string is printed. Finally, the string must be printed in reverse and displayed. The final part is where I am having my problem. I have the strlen function determine the legnth of …

Member Avatar for Juggler
0
227
Member Avatar for ramyasree

[code=c]struct DATA { pid_t pid; int lenth; char buff[128]; }; main(int argc, char* argv[]) { int pos,chlds,fd[2],ifd,ofd,i,n,nofreads[50]; struct DATA data; pid_t pid,child[50]; FILE *fp; pipe(fd); chlds=atoi(argv[1]); ifd=open(argv[2],O_RDONLY); for(i=0;i<chlds;i++) nofreads[i]=0; for(i=0;i<chlds;i++) if((pid=fork())==0) { // ONLY CHILD COMES HERE close(fd[0]); data.pid=getpid(); while((data.lenth=read(ifd,&data.buff,128))>0) { write(fd[1],&data,sizeof(data)); //sleep for random time (0-chlds seconds) sleep((rand()%10)+1); } …

Member Avatar for WaltP
0
186
Member Avatar for Dextral

Hi, I'm updating an IM client C app (for Windows XP) so that when a users screensaver comes on their presence state changes from online to away. What I've done so far is add: [code=C] while(TRUE){ refreshAutoAway(); Sleep(1000); } [/code] to the end of the WinMain function. This all does …

Member Avatar for Ancient Dragon
0
94
Member Avatar for rxgmoral

dll problem,help me:) i create dll project ,the dll is Use MFC in a Static Library i hope exe call ListCtrl class from dll ==================DLL==================== <<<<<<<<<<ListCtrl.h>>>>>>>>>>>>>>> [code=c] #pragma once class AFX_EXT_CLASS ListCtrl :public CListCtrl { public: __declspec(dllexport) ListCtrl(); __declspec(dllexport) ~ListCtrl(); public: DECLARE_MESSAGE_MAP(); public: afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult); }; …

Member Avatar for Ancient Dragon
0
184
Member Avatar for s88

The problem is that when I enter the choice, nothing happens and the answer remains 0. Please help I'm new at this and I tried everything!! Thanks [code=c] #include <stdio.h> #include <conio.h> main () { int a,b; float answer; char choice; clrscr(); printf ("\nEnter a number: "); scanf ("%d",&a); printf …

Member Avatar for s88
0
301
Member Avatar for clemente

In response to Hike34's thread to add a \ character to a CString, I think the \ character has a meaning in such strings and to use it in a string it should itself be preceded by a \ character CString word="hello world"; word+="\"; // or "''" doesn't work... Instead …

Member Avatar for ~s.o.s~
0
101
Member Avatar for SlightlyAngelic

[code=c] #include<stdio.h> #include<math.h> # define I 0.0765 //Interest Rate char fname[20]; char lname[20]; float loan = 0.0; int years; double PB; //Prototypes double Mortgage_Calc(void); void Financial_Report(void); int main() { printf(" *******************Caribbean Mortgage Company*************\n\n\n\n\n"); printf("Enter the Customer's Name (First Name and Surname)\n"); scanf("%s%s",fname,lname); printf("Enter Requested Loan Amount\n"); scanf("%f",loan); printf("Enter Number of …

Member Avatar for Salem
0
133
Member Avatar for pointers

Hi i hav executed the following c code..the inner printfs executes first and prints some garbage value...why dont the outer printf prints anything... i got only one garbage value y dont two garbage values....wt s the order of precedence in printf function and in nested printfs.... the c code is …

Member Avatar for ~s.o.s~
0
102
Member Avatar for sgriffiths

Hello can anyone help me with the following The below will actually display the Name found part, even though no name actually exists and its just blank, how do i get round this, the string name will contain blanks, but i need to check if blank, then treat as blank. …

Member Avatar for Nick Evan
0
108
Member Avatar for Manas Kumar Sen

The following profram is not compiled. Why? Please help me! //This is a file copy utility// [code] #include<stdio.h> #include<conio.h> main(int argc, char argv[]) { FILE *fs,*ft; char ch; if(argc!=3) { puts("Insufficient Arguments!"); exit(); } fs=fopen(argv[1],"r"); if(fs==NULL) { puts("Cannot open Source file"); exit(); } ft=fopen(argv[2],"w"); if(ft==NULL) { puts("Cannot open Source file"); …

Member Avatar for Nick Evan
0
82
Member Avatar for waldis

Hi, Once I had a similar problem when I tried to read a binary file on a pc and I failed, but I was able to read it in Linux (there were actually different versions of the file), so I figured it's a corrupted file, thou the hex dump looked …

Member Avatar for waldis
0
96
Member Avatar for simmyhp

Hi, I have written the code of checking already, but I have got two problems here. 1. I don't know why when I enter the number in, when it prints out the number, it becomes smilies or some kind of maths code. Please tell me what I have done wrongly …

Member Avatar for WaltP
1
103
Member Avatar for kissiwat

All I'm trying to do is write a very simple loop program in C to enter the ages of four sprogs between 5 and 7. To display their total and average age using do, while and if statements. I also need to display an error message if an invalid number …

Member Avatar for Lerner
0
144
Member Avatar for depsch

I have a basic question with a for loop statement where I have a function thats creating input nodes inside my animation program. The name thats assigned to the input that the function creates is "InputNum" . How do I tack on the value of i to the end of …

Member Avatar for WolfPack
0
115
Member Avatar for rxgmoral

problem about font i write CMFont class,it inheritance CFont e.g: [code] class CMFont:public CFont {..........}; ======================== CMFont font; font.CreateFont(...); GetDlgItem(IDC_FONTID)->SetFont(&font);[/code] [code] error error C2664: 'CWnd::SetFont' : cannot convert parameter 1 from 'CMFont **__w64 ' to 'CFont *'[/code] how to CMFont convert CFont thank:)

Member Avatar for Ancient Dragon
0
91
Member Avatar for Raj@web

[B]Hey i have been working C, But i need to do a Convolution progrm in C, So pls advice on this matter How to initialize..[/B]

Member Avatar for Salem
0
100
Member Avatar for kimw

does anyone know how I can write to a xls that puts each number in different cells? for example, [CODE]vector<int> nums; nums.push_back(1); nums.push_back(2); nums.push_back(3); ofstream myfile; myfile.open("C:/example.xls") myfile << nums[1] << " " << nums[2] << " " nums[3] << endl; myfile.close()[/CODE] how do i put three numbers in different …

Member Avatar for Salem
0
136
Member Avatar for neeven

i need to write a program that- allow the user to enter the number of students-allow the user to enter each mark-calculate the frequency for each mark-the interval that exists between identical marksthis is what i have donei want to know if there is a different way of doing it#include#define …

Member Avatar for Salem
0
287
Member Avatar for tomtat

[code]/* a program to find all the permutations of an input string pointers are not allowed*/ #include <stdio.h> #include <string.h> #include <conio.h> void main() { clrscr(); int num =0; char buff[20] ; printf("Enter the string\n"); scanf("%s",buff); int len = strlen(buff); printf("%s\n",buff); for(int i=0;i<len;i++) { for(int j=1;j<len;j++) { for(int k=j+1;k<len;k++) { …

Member Avatar for ~s.o.s~
0
100
Member Avatar for pointers

could u tell me the use of static storage class before a function...like static add(); could u tell me a good link to get collection of programes in c language.... Thnaku and Regards.

Member Avatar for ~s.o.s~
0
88
Member Avatar for neeven

i need to write a program that- allow the user to enter the number of students-allow the user to enter each mark-calculate the frequency for each mark-the interval that exists between identical marksthis is what i have donei want to know if there is a different way of doing it …

Member Avatar for indianscorpion2
0
254
Member Avatar for tirivamwe

the function first search a word from the linked list. if found it then increment the numWords (number of words in listfor that word) and if not found it shoud create a new node for the word. the code is: [CODE]void AddWords( char text[30]) { check=head; while (check!=NULL) { if …

Member Avatar for Nick Evan
0
130
Member Avatar for FireSBurnsmuP

Alright, I cannot get the getline function to work. I have iostream included, using namespace std, and here is the syntax I have down: [inlinecode]cin.getline(playerOne, 21);[/inlinecode] with playerOne declared previously as a string, and I want its max input to be 20 characters. What's going on here? It's not working …

Member Avatar for WolfPack
0
154
Member Avatar for petzoldt01

Hello, I need to write a program that runs along with an emulator. The goal of my program is to intercept certain keystrokes before the emulator gets them, and then send the emulator back some different keystrokes. I want the program to use as few CPU resources as possible, as …

Member Avatar for iamthwee
0
127
Member Avatar for madankumar

We cannot have static friend function............ because 1.since static member functions can access only static data members...where as friend function can access all the members. 2.Friend function also require an object to access the members...where as static member functions can not. 3. Another thing ....since friend functions are non-member functions....and …

Member Avatar for ~s.o.s~
0
1K
Member Avatar for anksphenomenon

Hi I was goinf through the GTK code and saw that GTK code uses pointer for structs and not normal instances of the same structs... why could this be so? My take is that they wanted to use just one variable name and they can easily initialise the pointer to …

Member Avatar for ~s.o.s~
0
90
Member Avatar for tirivamwe

i have this line of code and want to compare the word from the linked list with the one supplied by user. the code is: [CODE] if (strcmp(p->word,word)==0)[/CODE] and i am having this error: [COLOR="Red"]passing `char' to argument 2 of `strcmp(const char *, const char *)' lacks a cast[/COLOR]

Member Avatar for tirivamwe
0
590
Member Avatar for aismm

I am supposed to use get the user input of a filename and then open that file and print to the screen (the first line-- that I will do later), and I can't figure out what I am doing wrong. Thank you. [code] #include <stdio.h> main() { char s[1000]; printf("Enter …

Member Avatar for andor
0
218
Member Avatar for tehloki

I am taking a programming course, and since we have not been introduced to string functions (puts(), gets(), etc) I need to take some input from the user using scanf. The assignment is to read a DNA sequence, storing it in a char array. The array must be 512 characters, …

Member Avatar for tehloki
0
251
Member Avatar for SammyHasibi

[code]#include <stdio.h> int function1(int a) { return(a*a*a); } int function2(int b) { int i; int sum = 0; for (i=1; i<=b; i++) sum += function1(i); return(sum); } int main () { int n, result; printf("Enter n\n"); scanf("%d", &n); result = function2(n); printf("Result = %d\n", result); system("pause"); return(0); } [/code] Explain …

Member Avatar for SammyHasibi
0
105
Member Avatar for Lun

i don't know why this program doesn't work.. it just keep on saying that it have errors..... pleae help!! please help!! [code] #include <stdio.h> #define LEX_LEN 1024 enum chars{ LETTER, DIGIT, UNKNOWN,ZERO,TULDOK, WHITESPACE,SEMICOLON,QUOTED,PLUS,MINUS, DIVIDE,LT,GT,EQ,ASS2,OPARENT,CPARENT }; enum Token { STOP, NUM, STRING,STMTSEP,QUOTED_CHAR,ERROR,ADDOPERATOR,MINUSOPERATOR,DIVIDEOPERATOR,SIGNEDNUM, SEMI,LTHAN,GTHAN,EQUAL,ASS,OPEN_PARENT,CLOSE_PARENT }; chars charclass; char nextchar; char parse_me[] = …

Member Avatar for Lun
0
148
Member Avatar for tirivamwe

can someone please help me to write a code in c to do the following: 1)read words from a file 2)store the words in a linked list 3)read the words and display 4)count the number of words in list

Member Avatar for tirivamwe
0
129
Member Avatar for taineechan

I want to find the length of a string, But the strlen function seems only to work with chars. I can't use a char[] to store my text because the size must be known beforehand and I don't know it. So I read everything into a string, then tried to …

Member Avatar for taineechan
0
137
Member Avatar for chris.lloyd

Hi, Just to make things obvious, I am a student. I have been learning C given an assignment to code a program similar to that used on the Voyager 9 probe. It uses hadamard matrices to make sure that bits transmitted through space have redundancy and are not lost. Each …

Member Avatar for chris.lloyd
0
173
Member Avatar for Mr.UNOwen

I'm having touble trying to send arrays from funciton to function. The thing I can't do is make a global variable (one of the rules set by the teacher). I don't know what I'm doing really, so let me know if it's even doable.

Member Avatar for TylerSBreton
0
120
Member Avatar for AnG'

[COLOR=#555555]Greetings C++ Lovers:[/COLOR] [COLOR=#555555]I'm a student very new to this C++. Yes I took Linux & UNIX. That was a year ago and I've never applied it to ANYTHING. If it's not too much trouble, I'm at a loss. A Big LOSS. You see, the reason I say this is …

Member Avatar for AnG'
0
129
Member Avatar for SammyHasibi

I have written a program with 2 functions which compute factorials & combinations. The functions work perfectly when called but I cannot insert a for loop at the end which sums up the combos. This part works (I have omitted the functions because they work when called for). [code]long factorial(int …

Member Avatar for SammyHasibi
0
97
Member Avatar for shariq
Member Avatar for balgarath

okay I am getting segmentation fault whenever I pass more than 300000 ints or so to be sorted....the code works fine for less than this with mergesort quicksort is sorting 100000 fine if they are in random order, but seg faulting if I sort a bigger number, or if the …

Member Avatar for Ancient Dragon
0
547
Member Avatar for khem Nath

a)how to run c++ program on Borland c package.I am preparing a graphic program on c++ but my progrm shows it can't run on windows. b)how a pointer is un limited array.:)

Member Avatar for Ancient Dragon
0
73
Member Avatar for mehakkapur

Hello, Can someone help me start my assignment on scheduling a round robin algo for the CPU Module. any help will be appreciated

Member Avatar for mehakkapur
0
67
Member Avatar for gip_mad

Hi all! I have just discovered this very nice website... Thank you all for all the "tips and tricks" posted! I just wanted to ask a little question... I'm writing a program in DOS, it's like a protocol sniffer for the serial port.. But i have a problem, since DOS …

Member Avatar for Ancient Dragon
0
107
Member Avatar for muhaa

Hi guy's i was wondering if any one can help i wat to make a random file generator which will be able to create random file's with random string's in them also i wilkl have to be able to control the file extension..Its for a file fuzzer im working on …

Member Avatar for muhaa
0
133
Member Avatar for joyce_16jo

hey,, i'm joyce, newbie.. I am very stuck in this problem,, had been on it in days. I've tried many prgrams but none seemed to work properly. the objective is to use a function that displays a reversed version of a long integer. e.g. 12345 then display 54321. Out of …

Member Avatar for Salem
0
98
Member Avatar for iubike

First off yes this is for school. I am using a basic program I already have that takes 5 numbers and averages them. I am trying to design a basic program that asks for name (easy), number of grades to calculate, then I input the grades in letter format; a, …

Member Avatar for iubike
0
133
Member Avatar for rhhaney145

Please Help, I am trying to create a visualizer for STEP (standard for exchange of product model data) files using C++ and OpenGL on Windows XP platform. I can get the OpenGL to draw some simple lines/shapes, the problem seems to be with parsing/understanding the file protocol. Has anybody out …

0
83
Member Avatar for dhruvisinha

hi, i need the program code and algorithm to find the sum of the sin and cos series, print 1/232/34543/4567654 in the form of a triangle. Please mail me the solution on <removed email as per forum rules> thanks so much.

Member Avatar for andor
0
97
Member Avatar for mitchelltab

I'm having trouble calling my linked list of Insernode. Can some one help me please. I need ot call it when it read teh data from teh file and puts it in the lists. I also need to use the list once i eneter in there data. adn if i …

Member Avatar for Lucanio
0
133
Member Avatar for boujibabe

this program is supposed to evaluate an equation of the form f(x)=ax2+bx2+c using the standard quadratic formula to find x This is what I've done so far [code] check=b*b-4*a*c; //Validate incoming data if (check>0) { x=-b+sqrt(b*b-4*a*c)/2*a; printf("The square root is %.2f",x); } else[/code] My question is how do I properly …

Member Avatar for boujibabe
0
170

The End.