49,761 Topics

Member Avatar for
Member Avatar for bernaprog

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: …

Member Avatar for Ancient Dragon
2
119
Member Avatar for thammalatha

can any one tell me what is the difference between map and multimap container in STL? thanks in advance.. iam new to this topic..

Member Avatar for JasonHippy
0
93
Member Avatar for chris.vargas.773

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 …

Member Avatar for Lucaci Andrew
0
692
Member Avatar for jayrharris21

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 …

Member Avatar for jayrharris21
0
550
Member Avatar for hartk1213

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 …

Member Avatar for hartk1213
0
404
Member Avatar for BevoX

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 …

Member Avatar for Microno
1
674
Member Avatar for nyfan68

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 …

Member Avatar for Schol-R-LEA
0
156
Member Avatar for salah_saleh

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 …

Member Avatar for Ancient Dragon
0
91
Member Avatar for jongiambi

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 …

Member Avatar for Ancient Dragon
0
279
Member Avatar for Vish0203

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 = …

Member Avatar for sbesch
0
153
Member Avatar for lior.mor.73

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 …

Member Avatar for Lucaci Andrew
0
80
Member Avatar for vicky30312

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. …

Member Avatar for Reverend Jim
0
283
Member Avatar for anukavi

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 …

Member Avatar for Lucaci Andrew
0
1K
Member Avatar for code_r

**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 …

Member Avatar for Gonbe
0
136
Member Avatar for nyfan68

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 …

Member Avatar for vijayan121
0
189
Member Avatar for chris.vargas.773

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. …

Member Avatar for chris.vargas.773
0
118
Member Avatar for nmajon

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

Member Avatar for mike_2000_17
0
177
Member Avatar for andrew mendonca

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. …

Member Avatar for andrew mendonca
0
360
Member Avatar for hister

#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 << " …

Member Avatar for deceptikon
0
193
Member Avatar for Everlight

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 …

Member Avatar for Everlight
0
3K
Member Avatar for GottaLove

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 …

Member Avatar for deceptikon
0
195
Member Avatar for muhammad.khan.3576

#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 …

Member Avatar for Gonbe
0
138
Member Avatar for hilol9872

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 …

Member Avatar for BobS0327
0
241
Member Avatar for thammalatha

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 …

Member Avatar for thammalatha
0
336
Member Avatar for andrew mendonca

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 …

Member Avatar for chaau
0
238
Member Avatar for 9tontruck

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 …

0
101
Member Avatar for spiderman.rapp

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.

Member Avatar for Ancient Dragon
0
43
Member Avatar for prahesh

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.

Member Avatar for mike_2000_17
0
228
Member Avatar for yxBen

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 …

Member Avatar for yxBen
0
667
Member Avatar for SphirosOkelli

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 …

Member Avatar for SphirosOkelli
0
148

The End.