49,757 Topics

Member Avatar for
Member Avatar for arsenal_fan

I am watching lectures on C++ from the stanford online courses website. I have a slight problem in understanding how memory is allocated for a string in C++. Basically when you declare a vector the constructor is called and memory is allocated for the array arr, numUsed and numAllocated are …

Member Avatar for arsenal_fan
0
165
Member Avatar for +_+man

hi everyone how to generate random codes given to the computer if i give three codes example : 123,234,567 i need to output anyone of these at a time

Member Avatar for daviddoria
0
97
Member Avatar for ThrasherK

I have a problem with code I am writing. I am supposed to count the instances of each specific digit that the user inputs. I am supposed to output blank digit appears blank time(s). I figured out how to get the numbers to go to different indexes in the array …

Member Avatar for ThrasherK
0
208
Member Avatar for Isabelle

Hello guys, This project requires the use of an array of pointers to aRandomNumberGenerator (i'll call it Random for short) objects. Both aDie and aCoin are derived classes of the Random class. I am to use the array to call the virtual function generate. My problem arises in my main …

Member Avatar for Isabelle
0
124
Member Avatar for LevyDee

((serverDlg*)m_pDlg)->OnReceive(port); I built a server using MFC, and had to get the foundation going by using examples online. The OnReceieve(port), is a function that I created in my CDialog class. ((serverDlg*)m_pDlg) is the part I don't get. This line of code is in a function in my socket class, and …

Member Avatar for LevyDee
0
207
Member Avatar for kooia

Hi everyone, I was wondering if there's a way to write a command to the terminal from a c++ program. I'd like to be able to have some kind of loop with a Makefile, so the last command on a makefile runs the makefile again. Otherwise, is there a way …

Member Avatar for kooia
0
167
Member Avatar for c++learner

Hello, I'm simply trying to keep track of how many times a space is encounteed in a string and then print the number of times to the console. Can someone please examine and give me a tip on what is wrong? Thank you! [CODE] #include <iostream> using namespace std; int …

Member Avatar for c++learner
0
180
Member Avatar for amit12

one thread try to read from vector and another thread try to delete from vector how to do it

Member Avatar for Agni
0
330
Member Avatar for kooia

Hi everyone, I want to copy the output of a program with another program so I can write it to a file. I'm running Ubuntu Linux, and I'm trying to see what my system is like with hwinfo. The list is too long, though, so I need to put it …

Member Avatar for kooia
0
120
Member Avatar for dansnyderECE

I'm trying to compile an executable (ELF file) that does not use a dynamic loader. I built a cross compiler that compiles mips from linux to be used on a simulator I made. I asserted the flag -static-libgcc on compilation of my hello.cpp file (hello world program). Apparently this is …

Member Avatar for vijayan121
0
2K
Member Avatar for xDer

Hey! I am using UDP sockets in IPV6 and i can't get the server to receive the packet sent by the client to the All Hosts ipv6 address ff02::1. The client is sending the packets as i see them in the wireshark. Can you help please? [CODE] Server #include <sstream> …

0
55
Member Avatar for sabareesh

// function declaration char* operator LPCTSTR(); // defenition char* String::operator LPCTSTR() { char* szArry = NULL; szArry[1024]; reurn(szArry); } how we can create a LPCTSTR string class member function in c++

Member Avatar for Ancient Dragon
0
236
Member Avatar for sfuo

So far I have written a program that draws text to the screen and I am able to change the font type but I am unable to change the font size. Here are the 3 main parts of my code that I think you need to see. Font structure: [CODE]typedef …

Member Avatar for sfuo
0
270
Member Avatar for nasnoma

My program basically asks the users for a value (s) then calculates and displays the First, Middle, Last, and Final. The users have a choice to enter the value either in integer, real or character. If the user enters it in real or character, it will be converted into integer …

Member Avatar for nasnoma
0
510
Member Avatar for adaniel058

I have tried to create a simple class where the program passes a name and telephone number to my class type and then prints it to the screen. It tells me I have undeclared identifiers, but I am constructing my program just like an example we did in class. Can …

Member Avatar for adaniel058
0
112
Member Avatar for mrnutty

Say you have a class Foo, and it contains some member variables. And in that class you have a const-correct function. Can you code some way in C++, that changes the private member variable, inside the const-correct function. For example : [code] class Foo{ int num; public: void doIt()const{ num …

Member Avatar for Fbody
0
94
Member Avatar for Anocondo

Can anyone help me create functions for doing this 1) three bool methods onCircle (Point *), outofCircle (Point *), and inCircle (Point *) for a Circle object C (so C->onCircle (P) for a point P means the point P lies on the circle C (i.e. the distance of P to …

Member Avatar for mike_2000_17
0
258
Member Avatar for XxPKMNxX

Ok, i have my code: [CODE] int seconds; clock_t clock(); seconds = clock()/CLOCKS_PER_SEC; if (seconds == 8){ FIVE.SetPositionX(-1); } //.... if ((AdventureGame.keypressed[DIK_F]) && (WOO.positionX == -10)){ //reset clock() here FIVE.SetPositionX(-5);} [/CODE] the clock starts when the program is run and after 8 secs, FIVE moves position. When i press F, …

Member Avatar for XxPKMNxX
0
193
Member Avatar for ota1it1iuss

Iam new to programing, so be gentle!!!! I have to program the Fibonacci Sequence up tothe first 29 numbers. The output starts at 1 2 3 5, not 0 1 1 2. What am I doing wrong to not get the 0 1 output. Here is the code: [code=c++\] #include …

Member Avatar for shabnamapi
0
421
Member Avatar for AamirH

Hi, I am writing a C++ program to "find and replace" strings. Following is the code: [CODE=c] void pt::replace() { string str( textpath ); string searchString( "\" ); string replaceString( "\\" ); assert( searchString != replaceString ); string::size_type pos = 0; while ( (pos = str.find(searchString, pos)) != string::npos ) …

Member Avatar for mike_2000_17
0
106
Member Avatar for hking

This is my assigment and i have no idea to do that. Somebody please help ! Write a program that reads from a file the number of candidates in a local election, then their last names and the number of votes received by each. Use dynamic memory allocation to store …

Member Avatar for mike_2000_17
0
245
Member Avatar for ichigo_cool

Well I've been learning C++ on and off but I plan to stick with it and I'm going to try to program at least two hours a day everyday for the rest of summer and hopefully when school starts again if I can. How often do you guys program? (just …

Member Avatar for mike_2000_17
0
611
Member Avatar for mdeveau

Here is the code that I have been given for an assignment. The modification that I need to make is to allow the program to read 10 sample points and determine which are contained in the plume boundary. I have included the modification that I think is appropriate for the …

Member Avatar for mdeveau
0
97
Member Avatar for askreiyna

i want to know the advantages and disadvantages of single and multiple line comment in programming language in term of reliability, readability and writability. please help

Member Avatar for askreiyna
0
76
Member Avatar for eftela

ei, anyone, i need help for my project, we need to create an info. system in c++ with the following functions: [LIST=1] [*]search records [*]add records [*]delete records [/LIST] i decided to use fstream for this code and i was able to view all records and add records at the …

0
55
Member Avatar for creative9k

I'm having a little trouble getting started on this HW assignment and would appreciate if anyone could clue me in where to begin logically. The program takes names from the user as input up to 200 names or they stop and stores them in an array then uses two arrays …

Member Avatar for Andreas5
0
165
Member Avatar for joewinsock

Tool.h file [CODE] #ifndef TOOL_H #define TOOL_H #include <string> using std::string; const int LENGTH = 30; class Tool { Tool ( int = -1; string = " "; int = 0; double = 0.0 ); public: int getPartNumber(); int setPartNumber( void ); char getToolName(); int setToolName( void ); int getInStock(); …

Member Avatar for Andreas5
0
276
Member Avatar for Anyzen

Hello i have a code here that partially works...the point in the program is to store 10 array integers then outputs how many times that integer is entered ex. input: 1 1 1 1 1 2 3 3 2 99 output : 1 = 5 2 = 2 3 = …

Member Avatar for Anyzen
0
162
Member Avatar for ZlapX

Basically everyone should laugh at how stupid this may sound but this code is somehow wrong... which is funny because it is as simple as hello world.... [CODE]#include "stdafx.h" #include <iostream> using namespace std; int main(void) { cout << "Wake up, Neo.\n"; Sleep(6000); cout << "The Matrix has you.\n"; Sleep(6000); …

Member Avatar for ZlapX
0
239
Member Avatar for katokato

Hey, im new to the forum and im trying to learn c++, so i bought a book. On a programming exercise i was asked to create a program that would take a persons full name, letter grade, then subtract the letter grade (ie: A to B), and age and display …

Member Avatar for katokato
0
100

The End.