49,761 Topics
| |
Hi all :) Recently i got a an assignment to be done which need to deal with c++ pointer.. This is the question : [B] Write a function that accepts a pointer to a C-string as its argument. The function should return the character that appears most frequently in the … | |
I have the following in the txt file [CODE] 1 Single.Standard Standard Empty ......... ........ 70 2 Single Standard Empty ........ ....... 70 [/CODE] I ahve the code below buts its not deleting the selected id [CODE] while(!file.eof()) { file >> roomnumber >> category >> type >> status >> datein … | |
How can i declare 2D array in visual C++ 6.0 as a member of class? this syntax of mine is giving error. class sparseadd { int *p; int row; int col }; sparseadd::sparseadd(int r, int c) { row = r; col = c; p = new int[r][c]; // here i … | |
[code] #include <fstream> #include <iostream> #include <cstdlib> using namespace std; int main () { char out_file_name[15]; cout<<"Enter the name of your output file: "; cin>>out_file_name; ifstream input; ofstream output; cout<<"Begin editing files.\n"; input.open("Input.txt"); if (input.fail()) { cout<<"Input file opening failed.\n"; exit(1); } output.open("output.txt"); if(output.fail()) { cout<<"Output file opening failed.\n"; exit(1); … | |
My main problem right now with this code is trying to get the carry function to work. Also, I know it isn't pretty code. Could someone help me in figuring out why this isn't working the way it is suppose to. The carry function is suppose to add the carry … | |
Hi all, So I'm working on this program to use a circular doubly linked list to implement a queue class. It went fairly well, but I'm stuck on the copy constructor, which causes runtime errors whenever I try to test it. Nonetheless, I really don't see what I am doing … | |
Hi everyone! I'm both new here, and new to programming. I'm still learning how it all fits together, and have been putting together a simple assignment, but I've gotten a little stuck, and so far the book hasn't been a help. I know it must be something simple, but for … | |
Hello everyone! I'm making a tetris program, and now I'm stucked a bit. I have to use the simple getch() function, but in a special way. I need to use it for exact time, and when the time is up, I need to break the function, even if I haven't … | |
I am a bit confused how to read this data and extract the information I want and eventually store into an array/vector etc ( which i will know how to do. I'll present what the text file says below. (Note that somehow everything is on one line on the text … | |
Hello, I'm getting an error when I try to compile the code and I do not know how to solve the problem. Please help! The assignment asks me to create a BOOLEAN function that can check if the graph is connected or not. So I decided to use DFS approach … | |
1. Keep It Organized - Do not hijack old threads by posting a new question as a reply to an old one 2. Keep It Organized - Do provide evidence of having done some work yourself if posting questions from schoolwork assignments 3. [URL="http://www.daniweb.com/forums/announcement8-2.html"]We only give homework help to those … | |
Hi, Im getin the following error when i try the code below..Anyone tell me whats wrong?? (name is defined in animal class).. 52 C:\Dev-Cpp\oopAssign1.cpp no match for 'operator>>' in 'std::cin >> name' [code=c++] void Animal::arrayDisplay(){ string name[3]; cout <<"Input 3 names:" << endl; for(int i=0; i<3; ++i){ cin >> name; … | |
Build a program that determines monthly payments for a loan. please add problem statement and pseudo code? Use these parameters: (1)Loan amount as a float (2)Number of months for the loan as an integer (3)Monthly interest rate expressed as a decimal as a float. Please do not pass the annual … | |
[CODE] #ifndef VECTORBINARYTREE_H #define VECTORBINARYTREE_H template<typename Object> class ArrayVector{ private: int capacity; int sz; Object* a; protected: void overflow() { capacity*=2; Object* b=new Object[capacity]; for(int i=0;i<sz;i++) b[i]=a[i]; delete []a; a=b; } public: ArrayVector(int initCap=16){ capacity = initCap; sz=0; a = new Object[capacity]; } int size() const {return sz;} bool isEmpty() … | |
My profesor added this line of code to a bubble sort saying that it made it more efficient by tracking the last swap. I don't understand how this would work [CODE] void bubble_sort(int a[], int n){ while (0<n-1) { int last =0; for (int i=0; i<n-1; i++) { if (a[i]>a[i+1]) … | |
Hello I want to pass a bidimensional vector to the constructor of all instances of [ICODE]MyClass[/ICODE]. All instances must use and share and modify the same vector. And I want to keep a reference to that [ICODE]main_vector[/ICODE] to use it later in the program I am passing it by reference … | |
Hello. I've got a problem that I haven't been able to solve after a long time searching. It's a simple problem. I have two forms. 1) Form1 2) Form2 I need to get from Form1 to Form2 and vice versa. I can get from Form1 to Form2 easily, but I … | |
Hi everybody! I am trying to use fork() and wait to perform a simple task with c++ but I have noticed that the performance is quite different from what I expected. [CODE] #include <unistd.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int number = atoi(argv[1]); int i; … | |
I wanted to do a simple date validation to disallowed string from entering when prompt. Pls guide me. Tks. Eg, "Enter the publish date in DD/MM/YYYY : ghghjb "Sorry, pls enter in DD/MM/YYYY" "Enter the publish date in DD/MM/YYYY : [CODE] # include<iostream> # include<string> using namespace std; class date … | |
This is the problem: [url]http://www.ntnu.edu.tw/acm/ProblemSetArchive/B_VV_Asian/1997/ProblemF.html[/url] I just need the code badly.. Pls. Help Me.. | |
An exercise that Stroustrup wants the reader to do is understand the output of the following program. [code] #include "../../std_lib_facilities.h" struct X { int val; void out(const string& s, int nv) { cerr << this << "->" << s << ":" << val << "(" << nv << ")\n"; } … | |
Hello I'm trying to iterate backwards through a vector. with a while loop it works fine. prints out: 12 8 4 1 However the for loop prints 196735 12 8 4 Could you please tell me why this is. Probably something wrong with my logic i don't know I'm using … | |
My rand() isn't very random. As a matter of fact, it's not random at all! I am running Ubuntu 10.04 on both home comp and laptop. When I execute the code: [CODE]#include <iostream> #include <cstdlib> using namespace std; int main() { int x; x = rand(); cout << x; return … | |
Again I come crawling for help... I made a program that makes coordiant points and lines with these coordinates. A new class is going to inherit from the class with the lines, and calculate the distance between a line segment and a point. I found the correct mathematical formula. With … | |
Using Object Oriented Programming, create an encryption/decryption program. Your program must be able to a. Ask the original text file name from user. b. Ask the destination text file name from user. c. Ask for option encrypt or decrypt. d. read from a source text file e. write to a … | |
Hi, I created a program that makes a multiplication table, I dont know where the .txt file is located after executing the program Im using turbo C++ :-/ [CODE]#include<iostream.h> #include<stdio.h> void main(){ int multiplicand; int multiplier; int toprow; int column; int repeater; FILE* Starter=fopen("[COLOR="Red"]multiplication.txt[/COLOR]","w"); cout<<"Insert the number of repetitions: "; … | |
Hello everybody, I am looking for a good C++ midi API. I have written a program in C++ that needs to be able to export MIDI. So far I had written my own export function, but I feel that the complexities of low level midi coding will become to great … | |
I am attempting to edit this Queue class to only use myBack pointer, i began having errors and now I am lost.... LQueue.cpp is as follows [CODE]/*--- LQueue.cpp ---------------------------------------------------------- This file implements LQueue member functions. -------------------------------------------------------------------------*/ #include <new> using namespace std; #include "LQueue.h" //--- Definition of Queue constructor Queue::Queue() : … | |
I am working on a project for school and I can't get my readFile function to work. There is something wrong for the arrays that I am putting in. Here is the text file I am trying to read from: 4 Assign1 200 10 Assign2 100 80 Project 100 45 … | |
im trying to convert julian date to calendar date and vice versa im not getting any errors, but the output im getting is ridiculous. any help is appreciated [code] #include "stdafx.h" /* int _tmain(int argc, _TCHAR* argv[]) { return 0; } */ int isLeapYear(int year){ return ((!(year % 4) && … |
The End.