49,761 Topics
| |
in response to an inclass exercise where the following question was possed: write a program using structures, which will capture a list of 10 movies, the data members should be title and year. the problem is the program is not capturing all the details and is printing unintelligible information. what … | |
Hi I got a problem with converting from LPARAM to std::string. What I do is getting the selected object from a Listbox, the example I found on how to do this is to convert the object to LPARAM. Now I want to convert this LPARAM to std::string and I've tried … | |
So basically I have: // FUNCTION double function(yadee_yada) if (input < 0) { return 0; } else { return something; //code } // END FUNCTION //MAIN int main { int menu; int input; do { cout << "Press 1, 2 or 3 (3=quit program)."; cin >> menu; switch (menu) { … | |
I am creating a program that stores information of hospital patients in a sequential text file.. I want to the program to be able to search for a patient using the patient name already in the text file.. The program is giving me no errors whatsoever so please look into … | |
I am currently trying to test a function with an infinite loop and im having a problem how to break. Is there anyway I can test this? Thanks in advance. void classA::process() { unsigned int return_val; proxy_class& proxy = proxy.instance(); while(1) { return_val = proxy.run(); if(0 == return_val) { //some … | |
All the images those i added in resources of qt project , now i have lost those .. but those are available in "qrc_qresources.cpp" file in any other form (i think 'hexa' ) .. i want to extract images to original form .png .jpg etc .. plx help | |
**It is my humble request if I can get minior help with function definition at the end where its says--- int countvowels (string test) { ** #include <iostream> using namespace std; //function prototype bool is_vowel (char c); //is_vowel(c) returns true if character c is a vowel and false otherwise void … | |
ERROR: No such file: Permission denied collect2: ld returned 1 exit status Process terminated with status 1 (0 minute(s), 0 second(s)) 0 error(s), 0 warning(s) (0 minute(s), 0 second(s)) Earlier, I tried dev C++ also, it was also raising the same problem. I don't know how to deal with this … | |
I am trying out friend functions in different files to see how it work. However, I am having problems compiling it with error after error. Well now I'm done to one error again, please have a look at my code: /* ---------- classOne.h ---------- */ #ifndef CLASSONE_H_ #define CLASSONE_H_ #include … | |
In the program below I'm a little confused with these two lines -> `fbin.seekp(n * recsize);` & `fbin.write(reinterpret_cast<char*>(&age), sizeof(int));` In the first one, why would we start writing to the file at position n * recsize instead of position 0? I would think that we would start writing at 0 … | |
Is anyone familiar with "removing" an image from screen with SDL? It's just simply a toggle on/off function that i'm looking for. I don't really want to free/release the image, since i intend on using it again throughout the program. switch (e.key.keysym.sym) { case SDLK_a: drawSDL_RenderFillRect(...); break; case SDLK_b: **remove … | |
File I/O With C++ Fstream **Intro** File handling is as simple as writing in a book, much easier to modify and find. It's so simple people get confused with it :-). Welcome to the world of file handling. We will use the c++ fstream classes to do our file handling. … | |
I'm trying to understand how the function encrypt works (linux), but event with this simple example is not working. Any ideas?. Thank you. #define _XOPEN_SOURCE #include <unistd.h> #include <stdlib.h> #include <iostream> #include <string> int main() { const char key[64] = "12" ; /* bit pattern for key */ char txt[64] … | |
//Hi all ,can you explain why does this functon has two returns? //How to read them? Is it like if/else? int _tmain(int argc, _TCHAR* argv[]) { int x, n; int res; int power(int, int); cout << "Enter a number:"; cin >> x; cout << "Enter a power:"; cin >> n; … | |
Can you tell me what's wrong with it because it's not running on visual studio and I need it right now??? #include <iostream> #include<vector> #include<algorithm> #include<limits> #include<fstream> #include<string> using namespace std; class PayRoll { private: vector<int> salaries; public: PayRoll(); bool searchSalary(int salary); void generateStats(); void printSalaries(); }; PayRoll::PayRoll() { ifstream … | |
i write a code that coun t the number of upper case letter in a string there is a problem my code count space as capital letter code is below #include<iostream> #include<conio.h> #include<cstring> #include<string.h> using namespace std; class Letters{ private: char str[20]; int num; public: Letters(){ str[0]='\0'; num=0; } void … | |
I want to make a program that can display the name and marks that user put and then the name will be sorted alphabetically. According to these two example i still cant get it. I have go through many examples on the internet but i still dont know how. Someone … | |
Hey guys, Was wondering if someone could assist me in elaborating the c_str() function... I understand that it returns a pointer to an array that contains a null-terminated sequence of character but could someone further elaborate upon this, perhaps with a simple example. Cheers, | |
hi! i have written a code of linked list using character array to add and display data, it can add data but not display. can anyone help?? thanks. #include<iostream> using namespace std; class node private: char data[30]; node* next; public: char showdata() { return data[30]; } void setdata(char c[40]) { … | |
hi so this code here as i test it on paper provides paranthesis on every leaf node, disregarding priority (operator precedence) how can i make it add those paranthesis based on precedence of operators? void printInfix(Node n) { if (n == null) { if (n.isLeaf())//if n is a leaf, therefore … | |
Can you make me a program that does this: Amount of numbers:5 // any number 123 // arrays 343 424 34234 344 // random numbers output mean: //calculates the mean standard deviation: //calculates the standard deviation | |
Using an array write a program that asks for 10 numbers of type int stores it in an array and traversing each item counting the number of items that are greater than 5. | |
hello I have an inquiry about reading from a file. so if i have a file and if it opens (meaning it is there) how do i check if there is data? ifstream file("example.txt"); if (file.good()) { //file.open("example.txt"); // is this necessary again???????? i read that the ".good" provide checking … | |
I did some don't know how to read into the vector, need help on this assignment: Rich Software Inc. has hired you for an internship position to create new payroll software for their employees. Your goal is to create a program that reads the newdata.txt file with their salaries. After … | |
Hi I have tried to implement Linked-List data structure and i was folowing a guide but i have an `error` in line 12 in `contactlist.h` I have included `contact.h` properly but still not working :-/ contact.h #ifndef CONTACT_H #define CONTACT_H #include <iostream> #include <string> #include "contactlist.h" class Contact { private: … | |
i continue with problems for use a callback function in a class member :( class Timer { private: typedef std::function<void(void)> timerprocedure; timerprocedure tmrprocedure;//can't be static int MilliSecondsTimer; bool blnDestroyed; UINT TimerId; HANDLE Timer1; static void CALLBACK MyTimerProc( HWND hwnd, UINT message, UINT idTimer, DWORD dwTime) { tmrprocedure();//call the lambda timer … | |
how would i make a program that outputs this: amount of vairiables: 3 3123 1412 2412 mean: 1414 standard viariance: 4344 | |
Is double pre-incrementing undefined behavior? Like ++++x or even ++++++++x. I think it must be since it all occurs between sequence points. But what could possibly go wrong? Or do you just not ask that question and automatically stay away from any undefined operations? Is double incrementing ever routinely used? … | |
Hi. I'm learning by myself data structures with c++ but i got stuck Here's my code: #include<iostream> #include<cstring> #include<string> #include<sstream> using namespace std; template<class T> // node class class nodeType { public: nodeType(); nodeType(T); ~nodeType(); nodeType *next; nodeType *previous; T data; //string getkey(); string Id; //void borra_todo(); void imprime(); // … | |
how to program a levi-civita tensor with 3 by 3 dimensions then prints it after? |
The End.