49,766 Topics

Member Avatar for
Member Avatar for Theisonews

how do i make an array read from a file. i tried google it. but i cant get it to work.[CODE]// theisonewscpp.cpp : Defines the entry point for the console application. // #include<iostream> #include <vector> #include <algorithm> using namespace std; bool myfunction (int i,int j) { return (i<j); } int …

Member Avatar for Theisonews
0
470
Member Avatar for predator78

Hello I'm learning a bit about data structures for the first time and so far I seem to understand how they work "I think" at this stage. My questions at this point would be. 1. Are data structures essentially classes minus methods which can preform actions on the memebers that …

Member Avatar for NicAx64
0
379
Member Avatar for aprilchica3

Hello, I have spent numerous hours re-working this code and I hope someone can clear up my confusion! This program asks the user to enter a file name which will then create and display that file with a poem in all caps. The user is again prompted to enter another …

Member Avatar for aprilchica3
0
174
Member Avatar for sergent

This is when I try to output uninitialized characters on the screen. I thought C++ should declare all of them to 0's (or '\0' for characters) when I declare them without initializing?

Member Avatar for NathanOliver
0
112
Member Avatar for TheSassyDragon

Im trying a practice problem from a textbook and here is my attempt at it, was wondering if I could get some advice both with structurally how to approach the problem, efficency, and any words of wisdom on dynamic memory. This is my study for my final exam which so …

Member Avatar for Lerner
0
288
Member Avatar for sha11e

Heard people say c# for big programs, c for fast programs and c++ is just something that failed at being object oreanting c is c++ useful?

Member Avatar for sergent
0
212
Member Avatar for jjssll

Hi guys, I'm new in C++ and I tried to compile the attached code without success. This is the output when using g++ under Ubuntu system /src$ g++ -c -Wno-deprecated -I../include Options.C Options.C: In constructor ‘Options::Options(const char*)’: Options.C:13: error: ‘parsequestion’ was not declared in this scope I tried several modifications …

0
131
Member Avatar for programing

i am write program that insert at tail in circular singlelinkedlist but i have some errors .. [ICODE]#include<iostream.h> struct node { int info ; node * next ; }; class clist{ private : node *tail; int size; public: clist(){ tail=NULL; size=0; void addtail(int x){ node *p=new node; p->info=x; if(tail==NULL) p->next=p; …

Member Avatar for programing
0
97
Member Avatar for sha11e

After some google-ing I found a page saying that .o files are " “Object Code” is just the translation of “Source Code”, which can be referred as machine language code." What .depend files are I didn't really understand. Someone said it... kinda... links to libraries or something? Else my exe …

Member Avatar for nezachem
0
180
Member Avatar for L0s3r

[CODE]class mymatrix{ private: int** arr; int m ,n; public: mymatrix() { std::cout<<"\nConstructor entered."; std::cout<<"\nEnter no. of rows of the matrix:"; std::cin>>m; std::cout<<"\nEnter no. of columns of the matrix:"; std::cin>>n; arr = new int*[m]; for(int i=0;i<m;i++) { arr[i]=new int[n]; } std::cout<<"\nConstructor exited."; } /****************************************************************************************/ mymatrix (mymatrix& t) { m=t.m; n=t.n; std::cout<<"\nCopy …

Member Avatar for L0s3r
0
188
Member Avatar for Labdabeta

I am making a diplomacy tool, for the board game diplomacy. I need to make a map of each territory. I have a 75 #define MAP_"NAME" lines but I don't know how to set them to a mask value that can be checked since I don't know any 75-bit or …

Member Avatar for Labdabeta
0
201
Member Avatar for pengkeanh

Hi All, For each element in data1, I need to figure out what elements in data2 are related to it. Also, for each element in data2, I need to figure out what elements in data1 are related to it. Therefore, I setup a mutual data structure as you can see …

Member Avatar for pengkeanh
0
369
Member Avatar for noobcoder

Hello all, I will be placing my source code onto pastebin and making it private as I am scared of my fellow students stealing my hard work for this class. So far I have about 1000 lines of code that is pretty easy to understand and it compiles and runs …

Member Avatar for noobcoder
0
2K
Member Avatar for britanicus

This is a part the extension module im writing for python using c++. ( The complete source is available as an attachment ) [CODE] #include <python2.6/Python.h> #include <iostream> #include <fstream> #include "structmember.h" using namespace std; typedef struct { PyObject_HEAD fstream file; } CppFileObject; static int CppFile_init( CppFileObject *self, PyObject *args …

0
76
Member Avatar for tikoti

Hi! I am looking for something to compact the clear and push_back in one line... [CODE] std::vector<int> v(3,100); v.clear(); v.push_back(4); [/CODE] I have thought that vector::swap may be usefull for this task but still figuring out how. Any sugestion or idea? Thank you in advance!

Member Avatar for tikoti
0
172
Member Avatar for pcgamer2008

Hello World !!! I am having problem in my project regarding mouse click within a particulr area on GL surface screen...when I click on that particular area..mouse click generates windows coordinate like (200,349). It's hard to sense the mouse click in that area on GL surface screen....so how can I …

Member Avatar for mike_2000_17
0
122
Member Avatar for dyingatmidnight

Okay this feels like a really silly question. Values that I have set to private should be able to be used through out that class alone, yeah. Say I have this: [code] #include <iostream> using namespace std; class Telegram{ public: Telegram(); ~Telegram(); void getData(); private: int **telegram; int rows, cols; …

Member Avatar for Narue
0
96
Member Avatar for geekme

While compiling a simple code in c++ i get the errors C:\Users\ila\Desktop\mule\mule.c|1|iostream: No such file or directory| C:\Users\ila\Desktop\mule\mule.c||In function `main':| C:\Users\ila\Desktop\mule\mule.c|6|error: `cout' undeclared (first use in this function)| C:\Users\ila\Desktop\mule\mule.c|6|error: (Each undeclared identifier is reported only once| C:\Users\ila\Desktop\mule\mule.c|6|error: for each function it appears in.)| ||=== Build finished: 4 errors, 0 warnings …

Member Avatar for JasonHippy
0
779
Member Avatar for pritpal.singh88

[code]ofstream f; char c; f.close(); f.open(s.c_str(),ios::out); if(f.is_open()) { cout<<"Press <q> to save file"; char *text; int count=0,count1; while(1) { system("stty raw -echo"); cin>>c; cout<<c; system("stty cooked echo"); text[count]=c; ++count; if(c=='q') { text[count]='\0'; while (text[count1]!='\0') f.put(text[count1++]); f.close(); break; } } [/code] please help me out in this syntax i was not …

Member Avatar for jonsca
0
111
Member Avatar for geekme

I need to implement graphics in c++.what IDE should I use and what are the library files required for it? Note-I have just a week time so please tell some suitable way by which I can learn. Regards

Member Avatar for Kanoisa
0
211
Member Avatar for lowhzplayinfool

I've been working for a while now on a module assesment which is due in tomorrow. The trouble I have is that I have an extension, the module has finished and there is no one in my school to ask since it's been the Easter holiday :( Instead of 'borrowing' …

Member Avatar for lowhzplayinfool
0
133
Member Avatar for geekme

while debugging my code in code blocks I always get this error "<filename> - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! what should I do?

0
60
Member Avatar for msrox

Hi there, I am new in C++/CLR. I am trying to access to Form1 property from a header file, but I can't. I have included this header file in Form1.h. Here is the source of the header file: // General.h #ifndef GENERAL_H #define GENERAL_H #include "Form1.h" void ChangeFormText() { Form1^ …

Member Avatar for Ancient Dragon
0
427
Member Avatar for peq

Title says it all, basically I'm just trying to print the pointer *p to display all the values in that array. [CODE]#include <iostream> #include <string> //#include <stdlib> using namespace std; void extend(double *p, double *q, double *a, int c); int main() { const int CONST = 10; double price[CONST] = …

Member Avatar for peq
0
206
Member Avatar for ragnarok511

I am currently a C# developer with about a year of experience. I am currently working on finishing my computer science degree with a minor in mathematics. I love the job that I am in, but I the things I really want to do are in C++ (i.e. game development, …

Member Avatar for thelamb
0
241
Member Avatar for geekme

I'm unable to use code blocks.I do not know how to compile and run code in this IDE.Please help.

Member Avatar for sfuo
0
38
Member Avatar for ronthedon

I've spent the last hour trying to figure out why my calculations are not adding up. Once i run the program it just output 0 for the total points program averages and etc and it also leaves student name blank. Can someone please help me figure out the issue. thanks …

Member Avatar for jonsca
0
180
Member Avatar for bigdan182

hey guys, im fairly new to this so feel free to tell me if i need to supply more info. basically i need to write code to read in a text file and store different values in different variables, so for example i would read in: bob 1.1 maths 1.2 …

Member Avatar for abhimanipal
0
250
Member Avatar for kucing

[code] 1: int main() 2: { 3: unsigned short x; 4: unsigned short y 5: ULONG z; 6: z = x * y; 6: return 0; 7: } [/code] Please ... i got to many error. When I want z value to write in Textbox form window. Just like var …

Member Avatar for jonsca
0
236
Member Avatar for msrox

Is there any LED control to add to MFC project in order to have some graphic sense of e.g a timer?

Member Avatar for msrox
0
113

The End.