49,761 Topics
| |
hi, I'm trying to calculate the percentage of an ammount of boxes in C. Ex: 4400. I have the next code: [CODE=c++]#include<iostream.h> #include<conio.h> main() { double a=2400; double b=8000; double per=0; per=2400*100/8000; cout<<per; getch(); } [/CODE] and return a negative value. I try to asign values at differents variables like: … | |
can any one tell me what is the difference between map and multimap container in STL? thanks in advance.. iam new to this topic.. | |
For a Class assignment i wrote a program that has to throw a logic_error and then catch it but my code doesn't work i don't know what am i doing wrong. #include <iostream> #include <iomanip> #include <exception> #include <stdexcept> using namespace std; std::logic_error; struct MyException : public exception { const … | |
Alright guys, brand new to the forum and I'm currently taking my first c++ course. I am not asking for anyone to do my homework for me, but I have been working on the same assignment for the past three days and have been unable to figure it out. Here … | |
i need some help with my assignment the link is to the assignment [Click Here](http://www.cwu.edu/~schwing/cs361/CPPprog4.html) Complex.h #include <iostream> using namespace std; class Complex { private: double realPart; double imaginaryPart; public: //Default Constructor Complex(); //Parameterized Constructor Complex(double r, double i); double GetRealPart() const; double GetImaginaryPart() const; void printComplex(); }; test.cpp #include … | |
This is my solution for generating prime numbers. With this code hopefully you can generate prime numbers with incredible speed. The generated numbers will be stored in a text file titled as "Primes.txt". I have a dual core machine, but this program does not support dual core architecture, so it … | |
I am working on a phonebook application and I am having trouble implementing the add and find functions in the phonebook class. I am not sure how I am suppose to implement the functions using the prototypes provided. Any help would be appreciated. #ifndef Name_H #define Name_H #include <iostream> #include … | |
Hi, I have a problem in evaluating a macro in this code: #include<iostream> #define _A_ some #define Func _A_Func using namespace std; int someFunc(int i) { return i; } int main() { cout<<Func(1); } I get an error: test.cpp: In function ‘int main()’: test.cpp:13:13: error: ‘_A_Func’ was not declared in … | |
Hi im writing a fill-in-the-blanks program and I am stuck on how to delete a node from a liked list. I am suppost to follow this psuedocode to finish the program. I think I am close to a solution, can anyone point out what im doing wrong? The list already … | |
Hi, I'm working on a small project and i'm stuck in a part where I need to replace the existing word in file with a new one. I really have no idea about it.. I'm posting the function block where i'm facing the problem void team::team_list() { string str = … | |
hi! i started my programming studies not a long ago. we work on c++ and somehow the program is not compiling on my computer. the software is legal, i installed and started it with no problem but when i do debug or build i always recieve this error at the … | |
I cannot get the math right for the higher option. When you run the program, the program will go lower, but it wont go go higher. What is it i need to change? this program is due by the end of my class today and i can't figure it out. … | |
Hi, I have got an integer as 0010000001. I need to remove the last 4 digits ie 0001 and the remaining digits is 001000(this is expected) The truncation of last 4 digit is standard. ie the size of last digits is always 4. can anybody help me to code this … | |
**Requirements** Write the following function: void splitDate(int dayOfYear, int year, int *month, int *day); dayOfYear is an integer between 1 and 366, specifying a particular day within the year designated by year. month and day point to variables in which the function will store the equivalent month (1-12) and day … | |
I have been working on this phonebook application for a few days now. I am suppose to Create classes Name, PhoneNumber, and PhoneBook that are employed by the provided phone book program, PhoneBookProgram.cpp. Class Name Represents the name for a listing in a phone book (example: Phil’s Pizza) Overloads stream … | |
i'm having trouble with this assignment for my cs class the directions say "Make operator+ combine together the contents of two TrashCan, as long as the contents does not exceed the size. Make operator- subtract one TrashCans contents from another, as long as the size or contents don't go negative. … | |
i must do an project with sorting using priority queue..i find some things on books but the code was with classes and i don't learned about it ...please can halp me with some oppinion | |
Define a getTopTwoScores() function with the specification and prototype shown below: // Set highest to the score with highest value and secondHighest to the score with the next highest value. // If there are two highest scores with the same value then set both highest and secondHighest to that value. … | |
#include <iostream> using namespace std; int main() { int n1, n2, n3, i=0; for (n1 = 1; n1 < 10; n1++) { for (n2 = 0; n2 < 10; n2++) { for (n3 = 0; n3 < 10; n3++) { cout << i << " " << n1 << " … | |
Hello, I have the following code: `#include <iostream.h> void main() { double test=3.46578953218549; cout.setf(ios::dec); cout<<test; }` I understand that iostream.h is outdated and Microsoft Visual Studio has iostream. However, When I remove the ".h" the setf, ios, etc, line 6 has multiple errors. So, my question is: How do I … | |
ASsuming in class , i have: class math { private: int x,y; public: bool operator>(const math& ); bool operator<(const math& ); } bool Point2D::operator>(const math &p) { return (this->x > p.x); } bool Point2D::operator<(const math &p ) { return (this->x < p.x); } bool Point2D::operator>(const math &p) { return (this->y … | |
#include<string> int str_len( const char * const src) { int len=0; while(src[len]) { len++; } return len; } int str_copy( char * &dest, char * src) // removed (const) to sore the string in dest.By using const,we dont have the // access to store the string.By using ampersand we can … | |
I pasted the code here: http://codepaste.net/hy5n6m . In that version creating a cypher is no problem but decrypting a code doesn't work. I've only gotten it to work a couple times and I lost those versions (because something else always went wrong there). I have a couple other versions which … | |
Hi, Iam using filestreams to create binary file (c:\\..\\abc.bin).I want to put some checksum when i try to open the file through programming ,like if it is previously modified through another application or done manually.At the point of opening the binary file i need to perform some checksum by checking … | |
Define a getScores() function with the specification and prototype shown below: // Get scores from console and return the number of scores recorded. // A negative value signifies end of input. // If more than MAX_SCORES values are entered then discard entries beyond the first MAX_SCORES. // Assume that MAX_SCORES … | |
There are lots of flash video downloader out there such as "http://www.flashvideodownloader.org/" and I am sure you have seen it too. I am hoping to capture the url of a video file which is playing in a flash video player in C++ or C#. How can I do it? Would … | |
Write a program that prompts the user to enter 5 numbers then prints the largest and smallest number to the user. Add a while loop to keep the program running until the user wants to stop. | |
I want to sort the array items using the vector. Example: int buff[4] = {15, 6, 55, 34}; std::vector<int> myVector(buff, buff+4); now i will pass the array in to sort the buff data in ascending order. mySort(myVector.begin(),myVector.end()); How to do this ? Kindly suggest. | |
HI people, First post here, please go easy on me :) #include <iostream> #include <array> int main() { using namespace std; array<int, 5> cppArr = {1,2,3,4,5}; //"missing braces.." error and unresolved symbol highlight return 0; } With "-pedantic -Wall -Werror" specified, compiling the above snippet in eclipse (using cygwin or … | |
I have written a code that reads and input file, does some silly little calculations with some functions. It's a schoolwork assignment, but its done :) With one small kink- I need to create an output file. Well, actually I can make the out file just fine. But I have … |
The End.