49,761 Topics
| |
Hi all. I have recently been learning C++ and have gained a moderate understanding of how things work. Texts files seem to confuse me though so i was wondering if someone could help me out. :) Basically I have a text file which looks something like: [CODE]** <Question> What is … | |
Gooday i have a question to make a program using the connect function and all i hve done is below. how do i complete the the first loop and the second loop...on what i should do next here is my code so far, explaination will be appreciated....[CODE] #include <iostream> using … | |
what is wrong with this? i keep getting an error that says error C2059: syntax error : 'if' && error C2059: syntax error : 'else' [code] int main (void); void menu(void); int getChoice(void); int *year, *day, *month, julianday; int dayspermonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, … | |
I am trying to write a program that allows the user to input positive integers between 0 and 1000 and then outputs the highest value and the lowest value. The user should enter -1 to signify the end of their input. I am supposed to use a loop to achieve … | |
For my program I am supposed to implement an encryption and decryption algorithm. I then have to print it out using my functions I have to read the input from a file, “plaintext.txt” The file will contain plaintext strings that are all lowercase, and be of the format: 3 hello … | |
MY ASSIGNMENT: Write a program that works with fractions. Your program should be able to add, subtract, multiply, and divide two fractions. Specifically, your program must request two fractions from the user, getting the numerator and denominator separately for each fraction, and the operation to perform (add, subtract, multiply, or … | |
Whenever I run this code the while(b<63) only seems to run once then does nothing. The (a<63) loop runs fine but doesn't go again because the first loop just stops. Any idea what's going on? [CODE]#include <iostream> #include <time.h> using namespace std; int main() { int a,b,c,sand; int land[64][64]; srand((unsigned)time(NULL)); … | |
This is the question : you are burning some music CDs for a party. You've arranged a list of songs in the order in which you want to play them. However, you would like to maximize your use of space on the CD, which holds 80 minutes of music. So, … | |
I have this homework in which I have been working on it: but I dont know what im doing wrong :( Could anyone help me: [code]#include <iostream> #include <cstring> using namespace std; class Account { private: char number[8]; char type; char owner[31]; double balance; double interestRate; public: Account() { number[0] … | |
[code] class Security { public: virtual ~Security() {} }; class Stock: public Security {}; class Bond: public Security {}; class Investment: public Security { public: void special() { cout << "Special Investment function" << endl; } }; class Metal: public Investment {}; int main() { Security* s = new Metal; … | |
Hello, I am having a problem with an assignment that I have to submit tomorrow which is to let a user construct an object. in the assignment it is asked from me to create a DVDshop class where the user can create a DVD object. Also, in this class I … | |
Write a program that will read in a sentence of up to 100 characters and output the sentence with spacing corrected and with letters corrected for capitalization. In other words, int the output sentence all strings of two or more blanks should be compressed to a single blank. The sentence … | |
I'm trying to use a getline function in my program. I have the correct cout function but when I try and enter my input the program keeps wanting me to enter a couple of times and then that's what comes out. I'm very confused on what I'm doing wrong in … | |
I have written a program that allows for two people to play tictactoe, however it will not work. I am not sure what the problem is. Can some please help? Thank you in advance | |
Hi I wanted to start a project on implementing packet sniffer. Though I have fairly good experience of C++ programming and network protocols( theoretical), I am not able to get start with this. How should I approach towards it. What libraries or resources should be helpful ? Would Qt be … | |
Hi All, Please find the below code and please elaborate how derived class default copy constructor is calling base class copy constructor which is implemented by the base class. [CODE]class X { X( const X& x ); } class Y ; public X { } class Z { void fun( … | |
I'm a beginner as far as c++ is concernt.I want help using user defind funtions | |
hello, so im designing a simple prgram which calculates the cost of a ticket you buy. there are only 3 ticket options, namely a b and c. here is my code. [CODE] #include <iostream> using namespace std; const int PRICE = 3; int find(int [PRICE]); int main() { int nums[PRICE] … | |
[B]Specifications (minimum):[/B] The CDROM class contains the following, private, data members: string Name; // The Name of the CDROM string CDType; // The Type of CDROM float Cost; // The Cost of the CDROM [I]The ONLY recognized (i.e., legal) CDROM types are, “Game”, “Word”, “Compiler”, “Spreadsheet”, “Dbase”, and “Presentation” (AND, … | |
| Im trying to create an object array that accepts values generated by a 2 random functions so that i can sort the objects in the array based on one value of an identifier (finishtime) in each object. eg. twenty Activitys with datamembers [starttime, finishtime, id] my code for the main.cpp … |
Hi, ive only started programming recently and as my second assignment i have to write a program that can convert uppercase letters to lowercase letters and visa-versa. i also have to make it stop when a full-stop is entered and count the number of times the program changed letter case. … | |
Hi, I've got such class template: [CODE=c]template <class Type> class Stack{ private: struct Element{ Type value; Element *prev; } *end; public: Stack(){ end = NULL; } void push(Type value){ struct Element *element = new Element; element->value = value; element->prev = end; end = element; } Type pop(){ if(end != NULL){ … | |
Greetings from Portugal to everyone. I'm building a project to a course in my university and i've stucked in some compiling error given by NetBeans and g++ in my dynamic array implementation. Glad if someone could give a hand to this. Here is the code [ICODE]#pragma once #include <iostream> #include … | |
This is a follow-up exercise to the one related to reference and dereference operators. Stroustrup asks the reader to modify that program to handle an array overflow. He wants us to specifically use the realloc() function. I read the tutorial here but didn't understand the example. I read other web … | |
Here's my main [code=c++] int main () { int list1[3] = {5,5,6}; int num = 3; int result; int *arr = list1; int maxVar; int *maxVarHolder; maxVarHolder = &maxVar; result = sumarr(*arr, num, *maxVarHolder); return 0; } [/code] Here's the function header: [code=c++] int sumarr (int *arr, int size, int … | |
I need the program to read 2 pieces of data from each line of a text. For example my txt is: [code] A Garbage B Garbage2 A Garbage3 A Garbage4 A Garbage5 B Garbage3 B Garbage [/code] Now IIRC the getline function breaks after the first space. The program is … | |
| Im trying to write a code for a class that has 20 activities .. each activity has a start time and a finish time. When i try to generate the times the start time is larger than the finish in some cases. can any one help me with my function … |
Anyone that develops GUI applications in C++ will definitely be familiar with the C++ <windows.h> class. However, I am wondering who wrote this vast class? | |
Hey all, I need to initialize an array to hold an image to all zeroes. The dimensions are that of an image [numcols][numrows][3], where 3 is for rgb values. I know this isn't necessary when I'm reading an image into the array, of course, but I'm going to be using … | |
Hello guys, this is my first post, so don't be harsh if I do something stupid. Well, the reason why I'm posting here is because I need to find a method to alter the stream itself, not just the buffer I send to a variable with "file.Read(". For example, lets … |
The End.