49,757 Topics
| |
So here is what I'm trying to do: `Inline Code Example Here` my constructor takes a char pointer: lengthString = strlen(nameSentFromMain) + 1; namePrivate = new char[lengthString]; strcpy_s(namePrivate,lengthString,nameSentFromMain); next in the destructor to avoid memory leaks I have: delete [] namePrivate; The error I'm gettting says _BLOCK_TYPE_IS_VALID(pHead->nBlockUse). Strangely enough the … | |
I just build Boost_1_52_0 and the resulting Boost Include directory and Lib directory appeared outside the boost directory folder. Is this supposed to happen? I placed a directory on my C drive called 'Boost' (C:\Boost). I then unzipped the contents into that folder. Another folder containing the boost source code … | |
#include<iostream> #define MAX 1000000 #define loop0(i,j) for(int i=0;i<j;i++) #define loop1(i,j) for(int i=1;i<j;i++) using namespace std; bool flag[MAX]={0}; int tree[MAX]={0}; void update(long int node,long int b,long int e,long int i,long int j) { if(b>j || e<i) return; if(b>=i && e<=j) { if(flag[node]) { flag[node]=0; return; } else { tree[node]=e-b+1-tree[node]; flag[2*node]=!flag[2*node]; flag[2*node+1]=!flag[2*node+1]; … | |
i just started with C++ program so i know very little programming . i have to make a program that calculates tax the senerio is this Federal: 15% on the first $43 561 of taxable income, + 22% on the next $43 562 of taxable income, (on the portion of … | |
hey, just looking for a bit of advice on code readability, i've figured out a new and i hope better way to handle collisions but the when reviewing the code it all just blurrs together for me so is there some format teckneuqies i can use so its easier for … | |
Hello members, i need your help on this: The birthday paradox says that the probability that two people in a room will have the same birthday (month and date only) is more than half as long as n, the number of people in the room, is more than 23. This … | |
Im trying to get my program to do z=x*y and z=z+5.0 but not sure what I am doing wrong. #include <iostream> using namespace std; // Declaration: Tells the compiler how a function is called int multiply(int x, int y); int main() { // You can compile a call to the … | |
Would this be considered as a Subrountine problem? My program runs but I feel like it is missing something else. #include <iostream> using namespace std; void getData(int, int, int); int main() { int x,y,z; cout << "Please enter first number: "; cin >> x; cout << "Please enter second number: … | |
Hi..i m creating a project in turbo c++ with os windows 7 and i want to implement it dynamically.so how connectivity of oracle is possible with c++?(turbo c++ or dev c++) | |
I have been making a C++ application and currently checking if there exists any memory leak before release. My application will be running as an object over HTTP server and it should be idle until an HTTP request comes in. Which means it should release most of memories when it's … | |
How do I turn my problem to have suboutine. Not so sure how to do it. #include <iostream> using namespace std; int main() { int x,y,z; cout << "Please enter first number: "; cin >> x; cout << "Please enter second number: "; cin >> y; z = x + … | |
I am not sure what I am doing so wrong. Please help. #include <iostream> using namespace std; int addition(int x, int y, int z); int main() int x,y,z; int main(){ cout << "Type a number. "; cin >> z; cout << "Type another. "; cin >> x; z = x+y; … | |
#include<fstream> using namespace std; main() { ifstream infile; ofstream outfile; int num, pcount=0; infile.open("numbers2.txt"); outfile.open("evennumbers.txt"); for(int count=0, count<20; count++) { infile>>num; if(num%2=0); pcount++ } outfile<<"number of positive num is "<<endl; infile.close(); outfile.close(); system("pause"); } | |
All my function work besides one, and it is because I can't find whats wrong with my syntax on line 22, could someone please help me? I know it has to be a simple solution that I am overlooking. #include "Vector.h" #include <iostream> using namespace std; const int zero = … | |
Hi, I'm just settign up boost on my desktop (ubuntu) after a reinstall and am having some problems. I set it up last w/e on my laptop (knoppix) and did exactly the same thing and it works fine. I'm sure its something increadably simple I'm missing. I'm following http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html I'm … | |
I've needed to write sample code using conio.h over the years, but my compilers don't support all of it (most notable being clrscr() and gotoxy()). So I wrote a conio simulator class to help me. Not all of the conio.h functions are present, such as cgets() and cscanf(), because I … | |
**Note that this code works just fine when name is a regular string instead of a c-string.** I made this test program to figure out what was causing problems with my project. Turns out that the code for name that I put works just fine, but it messes up when … | |
I have been told it is good to overload the stream extraction operator to load data from a file. Would I simple use this in my class: friend ifstream &operator>>( ifstream &input, Class &C ) { input >> C.variable1 >> C.variable2 >> C.variable3; return input; } What are the advantages … | |
Hello i need help with a program i have to write for my class. I am stuck and still pretty new to coding. I would appreciate any and all help. the assignment is this: You are the game warden in your town and are responsible for stocking the local lake … | |
I need to send multiple request (command) to server at port 55005. My first request get process successfully & I received out put also. But for second request it gives error (WSAESHUTDOWN - Error 10058). After first requets I call shutdown(ConnectSocket, SD_SEND); Then only server process the first request & … | |
Hi guys, I have just started to learn c++ and I am working with robots. Every program is starting with main(int argc, char *argv[]) definition . I don't understand what does it mean?I am very glad if somebody canexplain for me . | |
Hey guys, I'm trying to understand how radix sort works in C++ : I've looked over the C++ implementation from wikipedia: void radixsort(int *a, int n) { int i, b[MAX], m = a[0], exp = 1; for (i = 0; i < n; i++) { if (a[i] > m) m … | |
I would like to convert a procedural database program that I have created to an object oriented program. In my procedural program I use a struct: struct shoes{ char Name[20]; int Number; double ShoeSize; }; Putting this into a class would I simply use: class Shoes{ public: //Function declerations private: … | |
I have to find which of the following values can be the degrees of an undirected graph with 6 vertices: a) 3 2 2 2 3 3 b) 4 2 2 2 3 2 c) 5 2 2 2 0 3 d) 5 2 2 2 1 2 I only … | |
Hi everyone, I have the implementation for a linked-list based Stack. I believe the entire code is correct, but only the way I call the push and pop function mighe be wrong. Any idea how they should be called? Mine returns garbage: #include <iostream> using namespace std; typedef struct Elements … | |
I created a program that will find the biggest number when give 3 different numbers. But when I want to change the program to find the biggest number when you enter 4 integer number I continue to run into problems. I can get it to find the biggest number when … | |
Hello, I was partaking in the global game jam (where you have to try to make a game in 48 hours). I got my game pseudo-finished, but I cannot get it to render the scene properly. Here is the code related to the rendering: Code for opengl initialization: glClearColor(0.5f,0.5f,0.5f,1.0f); float … | |
Hi, The Windows API function to select a directory is really bad, so I'm trying to use GetOpenFileName() instead. For that, the idea is to set a hook function, so that when the user hits the OK button without having actually selected a file, the hook function retrieves the currently … | |
How to store the elements and display?? struct A{ int level; char name[20]; struct b *a_b; }*d[3]; struct b { char name[20]; struct b *next; }; | |
Here's the assignment requirement: > Write a program that creates a series of one or more loan amortization schedules. The program should query the user for an input file name and an output file name. The input file will contain the number of schedules that need to be generated as … |
The End.