19,876 Topics
![]() | |
hey, i read that in C++ some programmers consider using break and continue statements as a violation of structured programming practise....... and usually avooid using them except in switch statements..., i will like to know how to use the structured equivalent of these statements..... i want to know the statement … | |
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 … | |
hi folks - i'm quite new to c++ and have written a program where i have used a linked list to simulate 3 printers working in a queue according to their priority. After much blood, sweat and tears I got that bit working. Now I'm onto the second "easy" bit...I … ![]() | |
Hi every one I have a big problem, I need help with creating a program which reads every third word in a text file and excludes puncuation like -,?.!'" etc.. so far none of my work need code or suggestions just plain help(newb) [code] #include <iostream> #include <fstream> #include <string> … ![]() | |
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(); … | |
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 … | |
Hi All, I have a question about the following C++ program: How does the C++ program know which of the sqr functions to use in this program? [code] #include <iostream.h> // This program illustrate the use of Function overloading int sqr(int x); float sqr(float x); double sqr(double x); int main(void) … | |
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. … | |
Hello there, does anyone know of any free beginner c++ videos on the net? . Thanks-:cheesy: | |
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. | |
I was assigned to create a program that lets the user enter the total rainfall for each of the 12 months, into an array of doubles. Then it needed to calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and … | |
hey, i just read about passing arrays to functions in C++ like this function modifyArray(arrayname, arraysize); i need help with sending an array and another variable to a function... since the array size is an integer and the second integer is also going to be in the argument... i dont … | |
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 … | |
Is anyone here uses subversion to keep the C++ header and implementation files to the repository? I need your help... Pls reply.. Thank you... | |
Is there a way to open, say, cout, and edit it to your own personal use? | |
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 … | |
I am new to C++ and programming in general, and am working on an upcoming homework assignment. I have run into several problems and would greatly appreciate assistance. The assignment is to write a code to determine area and volume in C++, using a While Loop. I am stuck with … | |
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) … | |
Could someone give me the syntax on how to add files in a working copy in subversion using the add command.As of now i am using import command to import folders in my working copy but this is exclusive for folders only not for file and I want is to … | |
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 … | |
Hello; I am doing a practice problem to write a program that allows a user to enter a number between 1 and 999. The code MUST be cutoff at 999 and no other numbers past that should work. I have developed a code, but it allows the user to enter … | |
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 … | |
Hi, I have a file in the format of: First-Name Last-Name StudentNumber Grade1 Grade2 Grade3 Any student may up to 10 grades, and I want to read the information from the text file into a vector. My question is, how can I read the file into the vector so that … | |
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. |
The End.