18,490 Topics
I am writing a short c program which simulates resource management on the operating system. The parent process is the resource manager and allocates resources to its children if they are available. I have created the processes and the resources, but I am having trouble communicating resource status between the …
I need to understand the folowing code return(fab(n-1)+fab(n-2)); As most of u will be fimiliar with this itz to make fabonachi series in C but can any one tell me How the computer Reads it i mean how is the sontrol transfered plzzz
plz someone tell me a program to add 10 numbers using the while(condition) loop very quickly plzzzzzzzz
variations of this are being posted repeatedly here. hope this will clarify things once and for all. [code=c] // to choose a random element from a sequence when // a. you do not know how many elements are there before hand // b. you want to make one single pass …
Hey, I'm hoping someone can help out here. I'm trying to use the rand() function to generate sequential random numbers in C, and then write them to file. Now I know it's possible, I'm just not sure whether it is the way I want to do it. I have already …
Hi everyone again me again I have lots of questions... I have a program which reads something into a txt file like notepad. But I need to read into a dat file. Here is my code [code] #include <stdlib.h> #include <stdio.h> main() { int employeeNumber; char name[30]; char engineeringDicipline[40]; int …
Hello, I have a problem with my Win32 app. I made a window, and than a Dialog boxes. For window I use one message loop, and for Dialog boxes another. But It seems this wont work: [CODE]while(GetMessage(&Msg, NULL, 0, 0) > 0) { if(!IsDialogMessage(g_hToolbar, &Msg)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } TranslateMessage(&Msg); …
Well i'm trying to get the path from which my app was launched so when it gets an exception i can just handle it and restart it, the only solution to this that i found was getenv ( "PATH" ), however doing this yields this: [QUOTE][Sat Apr 28 19:29:37 2007](null)/gtamp.cfg[/QUOTE] …
[code = C]struct m_b_e{ int a; struct m_b_e *next;};struct tree{ int b; struct m_b_e *block_list;};and function declarations .. void func(struct tree*);void func_in(struct tree*);definations .. void func(struct tree *p){ struct m_b_e *c,*d; printf("func..\n"); if(!p) return; for(c=p->block_list;c;c=d) { d = c->next; free(c); } func_in(p);}void func_in(struct tree *p){ printf("inner most function\n");}And, pointer p …
a) Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and calculate its complexity T(n).:-/ b) Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and with complexity T(n) is at most about (1.5)n …
I am a new user and I do not know how to post my code I wrote to be viewable on this site. If someone could please explain how I would go about doing this i would appreciate it.
A program to create a graph and to print the nodes traversed using DFS and BFS.
[COLOR=#000000]Dear All,[/COLOR] [COLOR=#000000]Was wondering if there is any way of generating the next values in an array to compute an np-complete system? Ok I know that sounds confusing but this is how it goes: [/COLOR] [COLOR=#000000]Say you have array[4][/COLOR] [COLOR=#000000]First Array is : 1 2 3 4[/COLOR] [COLOR=#000000]Second Array: 1 …
Hi Friends, Can any of you pls tell me (in detail) which of the following options will be faster? Option 1: [code] int fun() { if( !cm_aObject ) return -1; return cm_aObject->getNum(); } [/code] Option 2: [code] int fun() { try{ return cm_aObject->getNum(); }catch(...){ return -1; } } [/code] Thanx, …
[code=c] #include<stdio.h> #include<string.h> #include<stdlib.h> #define MAX 20 //struct team_info typedef struct { char team[16]; int played; int won; int drawn; int lost; int goalsf; int goalsa; int goald; int points; int ID; }team_info; team_info arrdetails[12]; int print_header(); void draw_table (); int take_team_input(); int take_team_name(); int save_table(); int read_table(); int sort_table(); …
Alright.. I have to rewrite a program. The thing is, I have to rewrite it using parent and children... With processes (pipes) or threads... How do you create the parents and children with either of these? I am basically asking for a tutorial on how you would create these with …
I am having problems generating the Fibonacci sequence. I would like to start at 30. Here is my program: #include <iostream> #include <conio> using namespace std; int main() { int Fibonacci, n; cout <<"Here is the Fibonacci number sequence until 30 ."; if ( n==1 || n==2 ) return( 1 …
I have to remove an element from index = 7 from an array and then move the rest of the elements to the positions 7, 8, 9, and so on.. i looked in my book but i cant find the remove code... does anyone know how i can remove the …
I cannot find my era as to why the program wont exit. No matter the number i input it still continue to run. If someone cant point out my era it would be highly appreciate.. [code=c] #include <stdio.h> #include <conio.h> #define FROZEN -99 #define BOILING 212 int main(void) { int …
Hello, I made a small app and I wanted to include DialogBox Here is a code: [code]#include <windows.h> #include "resource.h" const char g_szclassName[] = "myWindowClass"; BOOL CALLBACK WelcomeDDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDD_WELCOMED: { int …
Hi there, I've written a program that calculates the average of a few things. How ever somtimes the average can be say for for example 69.3%. If I was to get that value to show, would I use a float or a double? I've tried using a float but it …
So here is some sample code: [code] #include<valarray> int main() { std::valarray<double> vec(10); for (size_t i=0; i<11; i++) vec[i] = 1.0; std::valarray<double> vec2(vec); return 0; }[/code] So, in a situation similar to this one, I am segfauting, but not in the loop, rather in the constructor call after the loop. …
Hi everyone. It's my first time here, but I'll try not to be an obnoxious rookie. I'm doing a beginning course in C in college (yeah, original, I know :p), and at the moment I'm trying to work a project. First off, [B]I'm not trying to have someone do the …
I want to run external program to work with a file, which is asociated with that file extension. Example : if file is *.jpg, then I want to run image viewer. I want to do it under Windows.
Hi, Im a beginner at C, i just need some help getting something sorted where i can display information. I can add more to it for what i want to do, i just wanted to know why the error "ISO C++ forbids comparison between pointer and integer" comes for all …
hay i need some help here i am trying to do a quick sort this is the code i have and i am getting some errors i do not understand. this is the definition [COLOR=#0000ff]void[/COLOR][COLOR=#000000] quickSort([/COLOR][COLOR=#0000ff]int[/COLOR][COLOR=#000000] numbers[], [/COLOR][COLOR=#0000ff]int[/COLOR][COLOR=#000000] first, [/COLOR][COLOR=#0000ff]int[/COLOR][COLOR=#000000] last)[/COLOR] { [COLOR=#0000ff]int[/COLOR] i, pivot, left, right, mid; [COLOR=#0000ff]int[/COLOR] passes …
Hi there, I've writiten a program that asks a user to enter X number of users, it then asks the user to enter points and totals up the points. The cycle then runs again, dependent on the value of X. However I would like to obtain an overall average of …
1.Evaluate the following postfix expression using a stack and show the contents of the stack after execution of each operation 5,11,-,6,8,+,12,*,?. [COLOR=#000000]1.Modify the class Node such that the add_node () and del_node()functions are overloaded as the operators, + and -, respectively.[/COLOR]
[COLOR=#000000] [/COLOR] [COLOR=#000000]1.You are purchasing a computer. The moment you switch it on it runs automatically with some default operating system loaded in it, default RAM speed, and processor capability. Create a Computer class identifying the different attributes and behaviors. Code the constructor of the class and assign default values …
can I open a file in a URL? for example: fopen("http://example.com/myfile.htm","r") Will this one work? If not, what are the other alternatives in opening a file in the URL.. thanks...
hi! i need a c program code to display the structure a b c d c b a a b c c b a a b b a a a a b b a a b c c b a a b c d c b a. please help me
Please answer the following and post your code 1. You were tasked to build a module that calculates and prints the area of a rectangle, perimeter of a rectangle, and volume of a rectangle: Here's the header. calculate.h: void pr(float, float); void ar(float, float); void volume(float, float, float); Create the …
Hello For example I have a winapi GUI program called blabla.exe I have another winapi GUI program called TYCK.exe. Now how to make blabla.exe run in TYCK.exe?? I was using[CODE]system("blabla.exe");[/CODE], but this is not portable and it goes through cms, what I dont realy like. Is there any other way …
Hey there^^ Just a quick sort out hopefully, ive been hacking at this for a good while and cant figure out whats wrong for thie life of me! I have a program that uses calculates the maximum deflection of a beam under load (with some assumptions were allowed); and im …
I use Visual Studio 2005, and when I build to debug it compiles fine (with only two warnings). When I buid to realise I get this: [code]------ Build started: Project: TYCK, Configuration: Release Win32 ------ Compiling... main.cpp .\main.cpp(19) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'int', possible loss …
I realised I cannot run Win32 programs compiled with Visual Studio 2005 on any other computer. When I try running my programs on a computer where no VS2005 is installed I get an error: [CODE] This application has failed to start because the application configuration is incorrect. Reinstalling the application …
Hello, We just started studying classes right now, we are studying classes. Unfortunately, my teacher is not very helpful. I was given a study guide for my midterm and one of the questions there was to create a half adder. I already did the .h part and i believe it …
hi friends, This is my very 1st message on this site. Can someone please help me out in designing a small function in c programming to accept decimal value as hex value, i mean lets say if user inputs a decimal value say 49, the processor should read(and futher processes) …
Hello, I need help with Lee algorithm. Just a quick reminder of what it is: Start at a point, assign the cost of 0 to that point, and expand vertically and horizontally until target is hit. See below: ______3 ____3 2 3 __3 2 1 2 3 3 2 1 …
how to allocate memory for a two dimensional array dynamically please need code for that one
Guys I have to subit my lab record tommorow.....i just have some programs left which iam not able to do.:'( 1. Write a program to print the pascal triangle 2. Write a program to concatenate two strings without using teh library functions, by pointers 3. WAP to compare two strings …
"Write a program that has an array of at least 20 integers. It should call a function that uses the linear search algoritm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The program then …
Hi. Well, I got my subscription program right (thanks for all of the help, everyone!):) [CODE] #include <iostream> #include <iomanip> //Needed for the showpoint and setprecison command #include <fstream> //Needed to use files #include <string> //Needed to use string variable #include <conio> using namespace std; int main() { char choice; …
I have a questions where I need to overload the + operator for vectors so that I can add two vectors together. The question I have is on how and where to write the code. what is the definition of the + operator for STL vectors? template<typename T, typename Allocator> …
hi, does anyone knows if is there a way to make getchar non blocking? I'm using curses and I'm on linux platform. With a thread version of the same program I have solved my problems with getch and with the timeout function but now the program doesn't work properly and …
I'm going nuts i need to do a program that will count words, vowels and consonants and special character, i'm just a beginner and my teacher is killing me with this.
hi every one, im working on a project which is the assembler of SIC language,im using a mixture of c and c++ functions in my c++ program by including <stdio.h> and <iostream.h>header files.... my problem is that im reading from file,this file contains the source code of SIC language...i want …
Hello, let's say the user enters a value in this format xx:xx:xx where xx is an integer, how can I assign each xx to integer vars? I though of everything I know.. can't use getline(),getchar() bcuz they accept characters only, can't use cin either.. thought of storing the xx:xx:xx on …
I need help someone im trying to delete the blanks of this array of strings stored in str[i] loop but cant copy wihtout delete spaces please help some one.. thanks [code=c] void deblank(char str[MAX_STR], char result[MAX_STR]) { int num; //variable to hold value for string length int i, j; // …
can anyone provide me with the subtraction bwtween two huge integers?:'( I totally don't have any idea of solving the problem>>. Please...
The End.