51,593 Topics

Member Avatar for
Member Avatar for badprogrammer

[B]Tic-Tac-Toe Game[/B] Write a program that allows two players to play a game of tic-tac-toe. Use a 2D char array with three rows and three columns as the game board. Each element of the 2D array should be initialized with a space. The program should work as follows. 1. When …

Member Avatar for mrnutty
-1
117
Member Avatar for Jackie91

I was having an error, it says cannot convert string into int..i have no idea how to convert string into int. My teacher asked me to read 5 students names into the array..help me pls.. [CODE] #include<iostream> #include<string> #include <stdlib.h> using namespace std; int search(int data[], int size, int value) …

Member Avatar for Lerner
0
152
Member Avatar for nahmartin

Quick help please I am writing some data to a file but I do not know the information required in the third line until after the file is completed is there a way to point the ofstream back to the beginning of the file so that i can edit it …

Member Avatar for mike_2000_17
0
433
Member Avatar for ssmg

Hi everyone; I have a character array of 13 elements and I already defined the first 5 ones. The rest chars are constant so all I need to do is assign the chars between 6-12 instead of writing them one by one.To make it clearer, say my string is "ILoveYouMary" …

Member Avatar for ssmg
0
124
Member Avatar for siriphonic.ner

*I need help solving this. Stuck half way. Would someone mind giving me an example of their program of this?* The local t-shirt shop sells shirts that retail for $12. Quantity discounts are given as follows: Number of shirts Discount 5-10 10% 11-20 15% 21-30 20% 31 or more 25% …

Member Avatar for siriphonic.ner
0
2K
Member Avatar for emps

Ok, this has got me banging my head against a wall. I have a structure defined in a header file. It get initialized in my "main.cpp" file, then later in a separate file "readconfig.cpp" it gets accessed to store information. I haven't been able to get it to compile except …

Member Avatar for emps
0
1K
Member Avatar for angelinrajeesha

Hi, what are the classes that cannot be instantiated in c++? I know that one of the ans is Abstract base class.what is the other one in c++? could you please help us?

Member Avatar for angelinrajeesha
0
622
Member Avatar for ThrasherK

I am new to programming but when I took my class on Visual Basic it seemed so easy and I learned it so fast. It seemed like a giant puzzle. Now I am taking a introduction course to C++ and I cannot seem to grasp the material at all. When …

Member Avatar for Fbody
0
677
Member Avatar for Garrett2011

Is there a macro that can get a text as input like "abc" and then extract characters in that text and generate a code using them, something like "{'a','b','c'}" ? thanks.

Member Avatar for mike_2000_17
0
209
Member Avatar for Garrett2011

Suppose we have following two classes: [CODE=c++] class Temp{ public: char a; char b; }; class Final{ private: int a; char b; char c; public: Final(Temp in):b(in.a),c(in.b){} //rest of implementation };[/CODE] can we initialize an object of the Final class with following syntax in upcoming c++0x standard: [CODE=c++] Final obj(Temp{'a','b'});[/CODE]

Member Avatar for mike_2000_17
0
257
Member Avatar for AkashL

I have heard you can efficiently use your GPU to do fast floating point calculations. This can be done using OpenGL but you may have to use the library in an unorthodox way or graphics card toolkits such as CUDA (by nVidia) which I guess is Graphics card specific. Does …

0
115
Member Avatar for angelinrajeesha
Member Avatar for StefanTUE

Hey all, I just started programming C++, (only formiliar with matlab/mathematica for image processing) . I like to find the min of my grayscale image. My image is a part of frame token from a webcam. But I don't even know what type of object my image is. Is it …

Member Avatar for StefanTUE
1
220
Member Avatar for solycutema

Hi all, Currently im doing a little coding to communicate between two PCs through RS232 ports. i am thinking of using: "writeFile" to send a string to the other PC, "readFile" to read back the acknowledgement string from that PC and "strcmp" to check if the read back acknowledgement string …

Member Avatar for solycutema
0
151
Member Avatar for bleedi

Hi, I'm studying C++ at the university and came across a problem in my exercises. Basically I'm trying to retrieve an integer from an object via its getter method. The object is stored in a vector. Here's the main.cpp part: [CODE] vector<Client> vektori; ... vektori.push_back(Client(account, firstName, lastName, balance)); ... vector<Client>::const_iterator …

Member Avatar for bleedi
1
184
Member Avatar for merse

C++ has a standard function isinf()? like isnan()? If yes, it returns true in case of +inf and -inf also?

Member Avatar for merse
0
182
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
170
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
100
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
212
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
126
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
210
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
171
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
184
Member Avatar for amit12
Member Avatar for Agni
0
334
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
124
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
58
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
238
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
271
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
521
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
115
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
96
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
269
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
199
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
424
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
110
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
248
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
613
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
79
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
188
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
278
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
164
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
242
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
107
Member Avatar for ChaseRLewis

Going through a text to help cement my knowledge of C++ but found code that wasn't explained and looks kinda odd to me. [CODE] #include <iostream> #include <string> int main() { using namespace std; char ch; int count = 0; cin.get(ch); while(ch != '\n') { cout << ch; ++count; cin.get(ch); …

Member Avatar for mike_2000_17
0
88
Member Avatar for phummon

Hi everyone, I'm a moderately experienced C++ programmer who's trying to do a little socket work. Don't ask why, but I'm to write a program which, when activated, sends an HTTP POST request to a remote end server. The socket part of the work is done and successfully tested; all …

0
149
Member Avatar for pepemongo13

Hi i hve to turn in this homework today and i have not been able to come up with the logic here is what it is need it and what i have wrote so far if you are interested i am willing to pay for it, thanks Program Description: A …

Member Avatar for Fbody
0
461
Member Avatar for aranjan

Okay so this is part of an assignment I have to do, but I am confused regarding the library routine as my professor has not covered it well. So my thing is what do it do to create the library...is it just a .h file with all the functions specified …

Member Avatar for mike_2000_17
0
156

The End.