19,876 Topics
![]() | |
how to write an optimized version of the following factorial recursion function in C along with some explanation please ?? [code=language] int factorial(int num) { if (num == 0) return 1; else return num * factorial(num - 1); } [/code] Looking forward for your help! Thanks, Nanda Kishor [B][url]http://www.c4swimmers.net[/url][/B] | |
i want to know what are the differences of different header and their uses or meaning when they will use in a program.i hope there is someone who can define their purpose. God blessed us. | |
hi i am a newbies in c program. I'm just 1st year college from the course of computer technology.i just want to know what was the purpose of flowcharting in a program.does it express an idea or a plan to make a program?. then what was the connection of these.?thaks | |
hi, i was wondering if it is possible to send a struct through sockets... thanks in advance, nicolas | |
Hello- I am having trouble with a program that I have written in C++. My problem is that I can't put the name information into my structure. I am able to add in the "name" the first time around, however, on the second loop it simply skips it and goes … | |
This is my assignment. Write a program to convert between yards and meters. Your solution must utilize functions to perform the conversions. Your functions must meet these requirements: One of the functions must use pass-by-value, returning the converted measure One of the functions must use pass-by-reference to store its result … | |
what is the source code for this [code] ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD DCBA ABC CBA AB BA A A [/code] | |
[COLOR="Green"]here is my program i think that it's right[/COLOR] [code=c++] #include<iostream.h> int main(){ int n,i=3; cout<<"please enter number to see weither it is a prime one or not"<<endl; cin>>n; if(n==2||n==3){cout<<n<<"is prime number"<<endl;} else if(n%2==0) {cout<<n<<"\t is not prime"<<endl;} else{ for(i=3;i<n;i+=2) { if(n%i==0) {cout<<n<<"\t is not a prime number"<<endl;break;} else { … | |
I have a problem that deals with reading a random access file and creating an index file, which is a file to hold the binary tree of the random access file. I have the index file created with SSN (key), relative address of the SSN in the random access file, … | |
hello does anyone knows the meaning of the error undefined reference to main. i'm getting the error when trying to compile a file without a main function with -Wall option | |
i have a program which outputs a [COLOR="Green"].prt [/COLOR]file for printing barcode. But i want to send the file directly to the printer port LPT1 for printing instead of having [COLOR="Green"].prt[/COLOR] file please any body suggest a solution. [COLOR="Red"]Regards Prashant[/COLOR] | |
I can make this program to copy diverse format wihout losts. example: C:\\animal.exe to D:\\animal.exe (The File location write in locale) [CODE=c++]#include <iostream> #include <fstream> using namespace std; int main () { char data[50]; char inputFile [100]; cout <<"Insert inputFilePatch :"<<endl; cin >> inputFile; ifstream inputFilePatch; inputFilePatch.open(inputFile); if(!inputFilePatch) { cout … | |
Hello All, I am trying to write a C program that reads a text file and output unique words sorted alphabetically using /usr/bin/sort. All non-alphabetic characters serves as delimiters and are discarded. I am having a problem just parsing the text file into words, getting SEG FAULTS. dbx gives error: … | |
I have been trying to write a code for Conways Game of life, the thing is I need to generate a matrix of char filled with the elements * or o(o marks a dead cell,*marks an alive one). The Rules: For a cell that is alive: Each cell with one … | |
Hey everyone, I'm working on function that will take in a char array, prompt the user to input a string, and then return that string to the function. Below is what I've been working on and yes, I know it is not the right syntax, but I'm hoping someone could … | |
I know there is a way to represent binary, octal and hex values in C, but how do you do it? Like, say, if i wanted to specify a hex number i would do, unsigned char i = 0xFF; or unsigned char i = 0x32; What if i wanted to … | |
Hi all I need to read a program in c/c++ in linux which shall read rtf file text and then informs me the information about the fonts properties of the text in rtf file. Can anyone tell me how to do that.. does any library exists for this that I … | |
I need to write a function that will take a char* string and populate a char* array with elements of the original string. The elements of the original string are whitespace-delimited. I have seen a function do this, but it is somewhat complex (deals with a lot more factors and … | |
Hi, I have an interesting question. I have this C# Application and I need to generate a report. I want to be able to print the report or save it to a file. Unfortunately I don't want it to depend on a third party software ( Crystal Reports, MS Word, … | |
Can u help me in my assignment in making a calendar program using turbo c. I have made a few functions but im now stuck. What will I do with this? User is asked to input year and month, then the out put will be the year and the Calendar … | |
[B][I][COLOR="Red"]good day![/COLOR][/I][/B] we were given a project. it is a program for an airline company. in this program, [B]the user can view vacant seats in the airplane[/B] then [B]he can make a reservation in any of those seats [/B]or [B]cancel a reservation[/B] he had made. he can also[B] view the … | |
I am designing an ftp client prompt in C (unix environment). At this point, I have an infinite loop with an fprintf of the prompt on stdout and an fgets for reading user input. I need help with the structure of my program. How do I implement this? I have … | |
Dear all; I want to join three strings become one string. For example char date1 = "03"; char date2 = "06"; char date3 = "2007"; char new string; what I need is new string like: new string =[COLOR="Red"]03-06-2007.txt[/COLOR] I will use new string as input file name that will be … | |
i got an issue of creating a QUEUE of integers in a circular array using C to insert, remove, display, show CAN ANYBODY HELP ME OUT HERE | |
hey guys, im having a hard time making this switch function catch letters and return the error message. [CODE]int main() { int choice; do { /* THE DISPLAY MENU*/ printf("================================================\n\n"); printf("Welcome to Walther's Tic Tac Toe Game.\n\n"); printf("what would you like to do?\n\n"); printf("1 Play Tic Tac Toe\n\n"); printf("2 Quit\n\n"); … | |
i want to find make a program for insertion in AVL binary tree therefore i want to find balance factor of a node by subtracting depth of right child from dephth of left child how will i find this depth. i am using array representetion of the tree. | |
I am having problems trying to figure out exactly what is going wrong with my code. I am trying to create a factorial program using an array. I have tried, unsuccessfully, various ways to make it work but I can not figure it out. Any assistance would be appreciated. [code=c] … | |
Dear all; I have problem in reading data file in C. I have data like this: 00:00:00 R- 0.0654 345 +19 00:01:00 R+ 1.5678 324 +19 00:02:00 2.3456 315 +19 00:03:00 R- 1.2352 324 +19 ........................ next until 1440 lines What i want is only the data in third column, … | |
I am writing a simple program that takes a string input from a user, stores it in a dynamically allocated array, changes it to upper case, and then prints. It works for all letters and symbols but when I use a space character, the program automatically exits. Can someone please … | |
does eny1 nos how 2 convert 16 bit to 8 bit if so plz tell me, i need a c program for it. thanx | |
I am writing client and server programs for a simple FTP. I am allowed to use chdir, getcwd and getenv. What would be a correct procedure to expand a user provided path correctly using these functions, assuming of course the user supplied path is stored in a c-string? Thank you. | |
"hello world". i have a question about gui programming in c++ or java. i would like to have a basic tutorial about gui's. could anyone help me about this. thanks! i am a k4Q3A | |
I have to use a recursive backtracking search to solve the classic "bucket" problem. ie. You have two buckets, one holds 5L, the other 3L. Find a way to get 4L into the 5L bucket, while only being able to fill/empty either bucket, or to pour one of them into … | |
Can someone please help me with this? I have been struggling with this for days now, and for some reason, my instructor's help is not working for me. I am not sure if it is because he is from Germany and I am taking courses on-line, or if it is … | |
like the title i wanna know how to output a B-tree like that: ****************A ************B******C ********D******E*******F the struct of B-tree is: typedef struct node { datatype data; struct node *lchild, *rchild; } BTnode,*BTREE "*" means escape thanks | |
Hi everyone. I am a very new in this forum!! I create a little code in c to generate a time series!! Is a file .out, and I can´t open it in an Spreadsheet, opens automatically on Word Processor, even when I try to open from the Spreadsheet [QUOTE] 1 … | |
I'm a newbie teaching myself C, can anyone show me how to write a code that generates the next license plate number when you input one containing 6 characters 3 letters and 3 numbers, and asks the user if they want to continue or quit. Thank you | |
Hey, I've written a tic tac toe program. Computer makes some random moves, but i want it to be smarter and make some intellegent moves. any idea how to approach it? here's the code i've written. Although it's not that high-level, it's working fine. [CODE]#include<stdio.h> #define BOARDSIZE 9 #define USER … | |
Hi all I started learning C# but I became annoyed at the need for the .NET enviroment on every machine the program was run on, so I switched to C++ and started learning that. I am hearing talk about C++ dying out and C# is better and is where all … | |
I'm trying to create a piece of C++ code which will only allow a user to enter odd numbers. If an even number is entered, the program must tell the user to enter only an odd number. Im comfortable with the whole output bit in the 2nd line above, but … | |
Hi people! I´m working in a code with a friend! Both employ Linux Platforms, but he works in Suse, and I´m working in Kubuntu. Both distributions suppose to work with the GNU/Linux libraries. We work the code on his machine with Suse. And runs perfectly well! But in my Kubuntu´s … | |
Hello, could anyone please help me with this. I have a hardware connected to my PC via serial port. This hardware is sending me data (in HEX format). Now i would like this data save to a .txt file. Please help me. Here is my code so far...if anybody is … | |
I don't know how to insert a paint picture to my c++ program .Can anyone help me. | |
[code=C] #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> int toAnyBase(int n, int toBase); // from base 10 (2nd) int toBaseTen(char array[256], int fromBase); // from any base (1st) int fromAnyToAny(char input[],int fromBase,int toBase); int main() { char input[10]; int fromBase=0; int toBase=0; int answer=0; int answer2=0; printf("Enter number :"); … | |
hello i wonder if there is a way to return an array in function like in java lang for example: int[] ret (int i,int j) { int[] a = (i,j} ; return a ; } or can i ewturn a pointer to a new array? i need it for function … | |
The assignment is as follows: 1. Print name 2. Ask user "How many cycles?" and accept integer answer. 3. Ask user "How many samples per cycle?" and accept integer answer. 4. Calculate total number of samples and allocate an array of doubles to hold them. Initialize doubles to zero. Hint: … | |
I'm trying to sort a list of names alphabetically, by isolating the first element of the string and compare, which I think should work, but there's an error, SISEGV with something about an invalid access to storage... I don't know, but my group mates and I can't figure this out. … | |
plz suggest a simple C program to find out greatest number using array.... | |
hi there... I'm new in this forum so I don't know how to start new threads, anyway.... I was wondering if anyone could help me with a login page, I mean by sending me a good tutorial, because I'm stuck in a homework, a web application that needs a login … |
The End.