49,761 Topics

Member Avatar for
Member Avatar for helloworld1234

Hello, I have a school assignment that i really need help with. I am supposed to create an X shape with asterisks using for loops. I am terrible at for loops so i was wondering if you guys could help me out a little in figuring out the best solutions. …

Member Avatar for tinstaafl
0
3K
Member Avatar for lewashby

I have been told that in C++ the concept of a string does not exist. A string is just an array of type char. So in the following code, is message an array because it doesn't really look like one? char *message = "I am having trouble understanding pointers"; std::cout …

Member Avatar for lewashby
0
243
Member Avatar for GottaLove

Suppose I have a code: Class A have items which is pushed into a vector...I want to access Class A element from class B through A's vector.. class A { friend class B; vector<A> data; //store info in vector }; Class B { void showDataInClassA(); A a; } void B::showDataInClassA() …

Member Avatar for Ancient Dragon
0
926
Member Avatar for chandnigandhi

I am creating a project in turbo c++ and it is based on kids and i want to implement the speech like it will speak(a for apple).so is it possible to do this?and if possible then please help me out.

Member Avatar for nova37
0
211
Member Avatar for sarah.mathieson.7

I am trying to write a program that creates a new file every time I use the application. Right now, this is what I am doing: outfile.open("Application.txt"); outfile<<"First Name: "<< firstName <<" "<<"Last Name: "<< lastName<<" "<<"Student Number: "<< studentNumber << endl; outfile<<"Email Address: " << emailAddress <<" "<< "Major: …

Member Avatar for vmanes
0
3K
Member Avatar for Synapomorphy

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 …

Member Avatar for mike_2000_17
0
240
Member Avatar for daino

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 …

Member Avatar for KaeLL
0
170
Member Avatar for abhilasha1

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

Member Avatar for abhilasha1
0
106
Member Avatar for sumbul.qaimkhani

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 …

Member Avatar for Milton Neal
0
152
Member Avatar for A Haunted Army

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 …

Member Avatar for A Haunted Army
3
260
Member Avatar for dan.gerald

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 …

Member Avatar for deceptikon
0
190
Member Avatar for ConfusedLearner

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 …

Member Avatar for deceptikon
0
113
Member Avatar for ConfusedLearner

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

Member Avatar for deceptikon
0
81
Member Avatar for chandnigandhi

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++)

Member Avatar for deceptikon
0
70
Member Avatar for 9tontruck

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 …

Member Avatar for Ketsuekiame
1
211
Member Avatar for ConfusedLearner

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

Member Avatar for vmanes
0
95
Member Avatar for ConfusedLearner

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

Member Avatar for shashikumar s g
0
256
Member Avatar for elijah.gallien

#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"); }

Member Avatar for deceptikon
0
104
Member Avatar for dreday92

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

Member Avatar for rubberman
0
169
Member Avatar for TheBrick

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 …

Member Avatar for TheBrick
0
201
Member Avatar for deceptikon

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 …

2
1K
Member Avatar for TexasJr

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

Member Avatar for NathanOliver
0
246
Member Avatar for Hey90

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 …

Member Avatar for deceptikon
0
433
Member Avatar for jorge.carmonajr

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 …

Member Avatar for Ketsuekiame
0
161
Member Avatar for Sandy20

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

Member Avatar for Sandy20
0
823
Member Avatar for derbende

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 .

Member Avatar for stephendstump
0
1K
Member Avatar for Duki

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 …

Member Avatar for deceptikon
0
313
Member Avatar for Hey90

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

Member Avatar for Hey90
0
620
Member Avatar for Fame95

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 …

Member Avatar for mike_2000_17
0
277
Member Avatar for group256

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 …

Member Avatar for deceptikon
0
280

The End.