49,757 Topics
| |
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 … | |
I need to write a program to decipher a code and process a set of characters in a text file. this is the text file: >EBC;Iit_is a CaPital Mistake tO_theorize Before_one has DatA123. There are 6 encrypted characters at the beginning of the file. The encryption is based on the … | |
[CODE] #ifndef LexA_H #define LexA_H #include <iostream> using namespace std; class LexA { public: int charClass, lexLen, token, nextToken; char lexeme[100], nextChar; private: char character; public: LexA(); void setChar(char); void addChar(); void getChar(); void getNonBlank(); int lex(); int lookup(char); #define int_lit 10; #define ident 11; #define assign_op 20; #define add_op … | |
I have created class menu and class number. I would like that my functions in class do sum, subtract, multiply, and divide. I've done sum, but I have problems with other functions. When I do difference, it is actually sum my numbers, and result of multiplication and division is 0 … | |
Hi all, I am senior in high school and I am currently taking computer science classes in which we are learning C++. I understand the most basic implmentations of C++ fundamentals. I am seeming to have a lack of full understanding with heaps. I have borrowed several books in the … | |
Hey so I wrote this blackjack program to read from file but i'm getting these errors on the specified lines: Error 1 error C2059: syntax error : 'while' line: 46 Error 2 error C2228: left of '.ins' must have class/struct/union line: 48 Error 3 error C2050: switch expression not integral … |
The End.