49,761 Topics
| |
2 week in programming I am learning to program in C++. I started off with 26 error, and now I am down to 1. I just dont understand what it is asking for in the errors. Can somebody help me out? I have tried to look on the internet but … | |
I had created a Person class with 2 fields ages and name, its member functions are [CODE] Person::Person(string n, int a){ name = n; age = a;} string Person::get_name() const{ return name;} void Person::increment_age(){ age += 1;} void Person::print() const{ cout << name << endl; cout << age << endl;}[/CODE] … | |
Hi all. There have been several threads where people are asking, [B]"is there any way we can develop iPhone Apps on Windows, or without using Objective-C?" [/B]The main reason people ask this is because [I]they either cannot afford a Mac, or cannot afford all the additional costs one has to … | |
Here is the question: Write a program that outputs the following Pascal triangle using two nested for loops. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 … | |
Suppose I have these two functions: [CODE]template<class T> bool largerthan(T a, T b) { if(a>b) return true; return false; } template<class T> int reduce(T ar[], int n) { list<T> buffer; buffer.insert(buffer.begin(), ar, ar+n); [COLOR="Red"]buffer.sort(largerthan);[/COLOR] buffer.unique(); copy(buffer.begin(),buffer.end(), ar); return buffer.size(); } [/CODE] I have two kinds of arrays for reduce(): string … | |
Write a program to find the nearest smaller prime number for a given integer; | |
Hi, I know that there are many topics about this, but, i read a lot of them, and no one solved my problem. I doing some exercises of the book "Deitel How to Program, 5", and in the exercise 4.27 i need to write a program that get a binary … | |
I have a list of things of things I need my code to do but I don't know where to begin. I need to: -Read the first line of a file which gives the number of grades in a set. -Transfer everything in a input file to and output file … | |
My program is supposed to open files, initialize variables, use the functions sumGrades, averageGrade and printResults. I am having some errors and was hoping someone could help me out. To begin with some errors I'm getting are: line 10- two few arguments to function 'void printResult(int, int, float, float, float, … | |
insertion into a set takes O(log n) time, which means ? I have heard about big O notation which desribes how memory usage changes when input changes. But log n ? n is probably the number for input values but i don't get it let's say i have 25 inputs … | |
My menu function looks like this and it works great: [code] int menu(string * teksty, int ile) { static HANDLE h_we = GetStdHandle(STD_INPUT_HANDLE), h_wy = GetStdHandle(STD_OUTPUT_HANDLE); int wybor = 1; CONSOLE_CURSOR_INFO cci = {0}; GetConsoleCursorInfo(h_wy, &cci); cci.bVisible = false; SetConsoleCursorInfo(h_wy, &cci); COORD p = {0}; DWORD k; //FillConsoleOutputAttribute(h_wy, 0x07, 80 … | |
Hi, I am new at CPP. I am trying to create a list using STL. I was looking at the pop_back() method, and it says that it delete the element from the list and also calls it's destructor. so myelement = list.back(); i can access it. list.pop_back() will delete the … | |
I recently made a switch to SDL as a cross platform alternative to directly accessing DirectX or OpenGL. In an attempt to port a section of my game framework, I encounter logic errors that (to me) make absolutely no sense. In this snippet, a sprite is simply a wrapper class … | |
Hi, I need some help with my C++ program. I've got these custom-made PlaySound(char[MAX_PATH]) and PlayMusic(char[MAX_PATH], bool) functions that use the BASS sound engine. When I call an instance of OPENFILENAME (found in the samples), the sound (.wav and .mp3) plays perfectly. My problem is that once the sound declared … | |
Hi all, I know this is a trivial question but I really got stuck. I keep getting "non-1value in assignment" when trying to access the pointer variable "next" using the getNext() function. It didn't show any error if I change the last 2 lines to [CODE] temp_ptr->next = after->next; //when … | |
I need to learn how to create a bot and would deeply appreciate any help I can get. The bot needs to be able to do specific operations at the same time(s) each day: (1) Click on a button; (2) Click on another button; (3) Fill in specific values in … | |
Hi, i have to write a program that gets users to enter some numbers and it has to sort them in descending order. I've nearly finished but i just cant get it to sort in descending order, only ascending (using bubble sort). Here is the program: [CODE]#include <cstdlib> #include <iostream> … | |
KK the code below is a loop part of my main program I just cut it out and made it compilable.... This is the problem... When the user enters a number greater than 2, its supposed to tell them to retry because that was not in the options menu... that … | |
I'm having problems with the code from my text book. I need modify the class so it throws an exception instead. The problem is that I get errors from the original code from the book. Any help on how to fix it would be great. Thanks in advance! ERROR: [COLOR="Green"]Error … | |
Hey, i know this is a commonly asked question (and will probably get burned for asking it again) but wanted an up to date answer so here we go. I'm trying to learn to program in c++ purely as a hobby. I have recently spent some time doing problems at … | |
So I started with C++ recently, and it's still very new and difficult for me but I think I'm starting to get the hang of it. Now I want to start making my first real-world app. I downloaded an SDK for a mobile application API and I want to make … | |
I can't think of a way to get rows out of a table. It was easy doing it with VB.Net and I'm just finding vc++ really difficult. This is what I have so far. I've connected to the database file and I am able to get the data shown onto … | |
Is there any diference between: [code] X* x = new X; X* y = operator new X; [/code] | |
hi how can i make program using for loops only that display the output below * * ** ** *** *** **** **** ***** ***** ***** ***** **** **** *** *** ** ** * * | |
I get this error: variable or field 'calc_score' declared void and I am pretty much stuck. Here is my code, it obviously isn't finished but I need to be able to get this void to compile to continue on. [CODE] #include <fstream> #include <iostream> #include <cstdlib> #include <iomanip> using namespace … | |
problem: the user will input an integer for example 12345 (5 digits) and the output should be: 12345 12345 12345 12345 12345 // depending of how much digit you input or if the user will input lets say 123hi and the output should be 123hi 123hi 123hi // the program … | |
Hi...I am not able to input text file correctly as desired...... data.txt -------- Jim A James A+ Smith Cathy D Dazy Peter C I am suppose to input the above file and fill the above data in two seperate arrays. For the second column, I am suppose fill NULL value … | |
i want to know whats the error over here. i just want to store the three value in a node and making a linked list but after storing two nodes that is headptr and than temptr, when the third node is made it stops. I think my error is somewhere … | |
myint.h [CODE]#include <iostream> // so that we can overload << and >> using namespace std; class MyInt { // these overload starters are declared as friend functions friend MyInt operator+(const MyInt& f1, const MyInt& f2); //friend MyInt operator*(const MyInt& f1, const MyInt& f2); /*friend MyInt operator++(MyInt& f1, int); // postfix … | |
Hi guys, Just wondering how i would access a particular variable from an object in an array?? Consider the code: [code=c]void Animal::arrayDisplay(){ Animal ani; Animal* arry[3]; string n,c; int a; for(int i = 0; i<3; ++i){ cout <<"Input name:" <<endl ; cin>> n; cout <<"Input color:" <<endl ; cin>> c; … |
The End.