49,757 Topics
| |
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; … | |
Hi all :) Recently i got a an assignment to be done which need to deal with c++ pointer.. This is the question : [B] Write a function that accepts a pointer to a C-string as its argument. The function should return the character that appears most frequently in the … | |
I have the following in the txt file [CODE] 1 Single.Standard Standard Empty ......... ........ 70 2 Single Standard Empty ........ ....... 70 [/CODE] I ahve the code below buts its not deleting the selected id [CODE] while(!file.eof()) { file >> roomnumber >> category >> type >> status >> datein … | |
How can i declare 2D array in visual C++ 6.0 as a member of class? this syntax of mine is giving error. class sparseadd { int *p; int row; int col }; sparseadd::sparseadd(int r, int c) { row = r; col = c; p = new int[r][c]; // here i … | |
[code] #include <fstream> #include <iostream> #include <cstdlib> using namespace std; int main () { char out_file_name[15]; cout<<"Enter the name of your output file: "; cin>>out_file_name; ifstream input; ofstream output; cout<<"Begin editing files.\n"; input.open("Input.txt"); if (input.fail()) { cout<<"Input file opening failed.\n"; exit(1); } output.open("output.txt"); if(output.fail()) { cout<<"Output file opening failed.\n"; exit(1); … | |
My main problem right now with this code is trying to get the carry function to work. Also, I know it isn't pretty code. Could someone help me in figuring out why this isn't working the way it is suppose to. The carry function is suppose to add the carry … |
The End.