49,757 Topics

Member Avatar for
Member Avatar for Trustify

I don't know what I'm doing wrong but I open my filed correctly but it doesn't display the contents in the file. Please help. [CODE]#include <iostream> #include <fstream> using namespace std; int main() { const int SIZE = 81; char input[SIZE]; fstream dataFile; dataFile.open("info.txt", ios::in); dataFile.getline(input,SIZE); system("pause"); return 0; }[/CODE]

Member Avatar for Trustify
0
161
Member Avatar for VernonDozier

I've done Hello World programs with Visual C++ Express 2010 before, but I always checked the "Empty Project" option. This time I selected a Console project and took the defaults. Program is below. [code] // HelloWorld.cpp : Defines the entry point for the console application. // using namespace std; #include …

Member Avatar for VernonDozier
0
1K
Member Avatar for mi2010

I want a c++ code to : play a segment of awave between two times entered by the user. for ex :to play a wave between 4 and 100 seconds.

Member Avatar for jackmaverick1
0
107
Member Avatar for rena0514

My program is suppose to create a two dimensional array that is read from a file. And use a recursive function to find how many white areas ('w'). My program runs with no errors but i cant get any response from my recursive function. Cpp file: [CODE]/* This program accepts …

Member Avatar for rena0514
0
216
Member Avatar for Saith

First, my program works. I'm posting my code for my own personal benefit with the help of your guidance to know of any better way of handling this code. I was considering the use of [CODE] while(cin >> grabname) [/CODE] to possibly continue grabbing from the input stream until '\n' …

Member Avatar for vijayan121
0
302
Member Avatar for marrkee

hello, i wrote a little program, but There are some problems. Can anyone help me? here is the code: [CODE]#include <iostream> #include <math.h> #include <fstream> using namespace std; bool tikrinimas(const char *filename) { ifstream failas(filename); return failas; } int main () { tikrinimas("example.txt"); bool failas; if (failas==true) {cout << "good";} …

Member Avatar for Narue
0
103
Member Avatar for gregarion

Hey guys, i been trying to tokenize a string using the boost library. [CODE]int main(){ using namespace std; using namespace boost; string s = "This is, a test"; tokenizer<> tok(s); for(tokenizer<>::iterator beg=tok.begin(); beg!=tok.end();++beg){ cout << *beg << "\n"; } [/CODE] The problem i am facing currently is that i am …

Member Avatar for vijayan121
0
407
Member Avatar for shadowscape

Hey, im trying to create a string like the following in c++ but am unable to find a example in the internet in order to help me as im new to c++ and still trying to learn. [B]XXXXX-XXXXX-XXXXX-XXXXX[/B] [QUOTE][LIST] [*]Custom Length [*]Custom Block Size [/LIST][/QUOTE] if someone would mind how …

Member Avatar for rubberman
0
154
Member Avatar for choboja621

Can anyone help / teach me on how to build shapes, specifically face shapes, in c++? We are assigned to build something like that and Im having a very big trouble abt. it. Any comment will do. Sites, Sample Programs, and just about anything connected to it. The header file …

Member Avatar for Arbus
0
81
Member Avatar for l1nuxuser

hello c++ dev team!!! i need lilibit help from you. like i write in my prevois thread i bulding now lab mangement, and tks to you i passt the SQL lavel, (tks lot)!!! so i'am stuck now in the view step, that meen when the seller well open the software …

0
134
Member Avatar for jimmymack

[CODE]// student.cpp - Script 9.7 #include <iostream> #include <string> // Declare the Person class. class Person { public: Person(std::string theName); void introduce(); protected: std::string name; }; // Declare the Teacher class. // Teacher inherits Person. class Teacher: public Person { public: Teacher(std::string theClass); void teach(); void introduce(); protected: std::string clazz; …

Member Avatar for jimmymack
0
157
Member Avatar for Euphan

I need to keep my coding skills up to snuff, but I'm having kind of a block. I don't know what to code. Anyone have any idea of some small projects that I can work on? Perhaps ones that would look good if i sent them to companies? Don't ask …

Member Avatar for Moschops
0
223
Member Avatar for aaronmk2

I commented by the last line. I am trying to print out the string in reverse. [CODE] #include <iostream> using namespace std; void add(string n); int main() { string B ="ABCDEF"; add(B); } void add(string n) { if(n.length() <= 1) { cout<<n[0]<<endl; return; } else { cout<<n[n.length()-1]; add(n[n.length()-1]); //this lines …

Member Avatar for Euphan
0
77
Member Avatar for munitjsr2

When reading books I was thinking that data hiding was to hide the data from the user so somebody who is using a C++ executable is an user and data hiding is implemented to hide the hide the data from the user( somebody who is using the exe file produced …

Member Avatar for Clinton Portis
0
160
Member Avatar for kas04

The Predator‐Prey game is a simple board game where bugs (predators) and ants (preys) move freely across the board. The following is a description of the game rules: -Predators and preys move on a 2‐dimensional closed grid -Predators and preys are not allowed to move outside the grid -The game …

0
113
Member Avatar for custurd122000

The compiler only displays a portion of the output and then it exits this is what it compiles: [code] =============================================== Operations on Empty lists: =============================================== Size = -886911509 Length = 0 empty list: Sum of two empty lists: Program received signal: “EXC_BAD_ACCESS”. sharedlibrary apply-load-rules all stringlist(2449) malloc: *** error for …

Member Avatar for ravenous
0
412
Member Avatar for gladtoplay5

I have been working on some code that calculates your BMI and then puts you into a category based on that. every time i try and run this program it either tells me that I am in the underweight class or the average class and I have no idea why …

Member Avatar for WaltP
0
99
Member Avatar for sfuo

Hey I am running into a problem with CoCreateInstance() in a program that I am using to try to disable all the network adapters. When I try to use [CODE]hr = CoCreateInstance(CLSID_ConnectionManager, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_NO_CODE_DOWNLOAD, IID_INetConnectionManager, reinterpret_cast<LPVOID *>(&pNetConnectionManager) ); [/CODE] I get two errors. undefined reference to `_IID_INetConnectionManager' undefined …

Member Avatar for sfuo
0
377
Member Avatar for ghost_from_sa

Hey guys I've been asked to create an array of objects on the heap for my assignment but I cant seem to find any examples that explain it well enough on the web. So what I got is: [CODE]//Heabder File class Wheel{ public: Wheel() : pressure(32) { ptrSize = new …

Member Avatar for ghost_from_sa
0
188
Member Avatar for munitjsr2

[code] #include <iostream> #include <vector> #include <algorithm> using namespace std; class A { public : void getData(); void putData(); bool operator==(const A &) const; private : int x; char name[90]; }; vector< A > v; void A :: getData() { cout << "id = "; cin >> x; cout << …

Member Avatar for mike_2000_17
0
2K
Member Avatar for fadi_1234
Member Avatar for woody0114

alright I need help and at this point I am desperate. Been working on this for a couple of days, mostly typing and then hitting the Edit/undo! This is a homework project. What the project is supposed to do is: 1. open a text file(einstein.docx) 2. Prompt user for a …

Member Avatar for woody0114
0
900
Member Avatar for predator78

Well I been studying like a rabid dog foaming at the mouth since I have a higher level language under my belt and my initial failiure at c++ as a first language. Anyway getting near the end of my first little tutorial and have a few more questions. 1. I …

Member Avatar for predator78
0
150
Member Avatar for GhostMonkey

Hey, I've got my code finished but I need a working exe file but I cant find where it is. The only files I have are the source codes and a sql server compact edition database file whatever that is, which I cant open. Anyone know where I can get …

Member Avatar for GhostMonkey
0
112
Member Avatar for jimmymack

[CODE]// rational.cpp - Script 9.5 #include <iostream> #include <string> // Declare the class. class Rational { public: // Constructor: Rational(int num, int denom); // The overloaded methods that implement // arithmetic functions: Rational operator+(Rational rhs); Rational operator-(Rational rhs); Rational operator*(Rational rhs); Rational operator/(Rational rhs); void print(); private: // normalize() will …

Member Avatar for jimmymack
0
114
Member Avatar for jimmymack

[CODE]// rational.cpp - Script 9.5 #include <iostream> #include <string> // Declare the class. class Rational { public: // Constructor: Rational(int num, int denom); // The overloaded methods that implement // arithmetic functions: Rational operator+(Rational rhs); Rational operator-(Rational rhs); Rational operator*(Rational rhs); Rational operator/(Rational rhs); void print(); private: // normalize() will …

Member Avatar for jimmymack
0
152
Member Avatar for Sonia11

I am working on a program in which everyting is perfect except Unhandled exception at 0x0041180c that I am getting at run-time and the location its specifying at is: [CODE]void candidateType::setVotes(int region, int votes) { votesByRegion[region-1]=votes; }[/CODE] I have checked it numerous times but still not getting it. Any help …

Member Avatar for mike_2000_17
0
172
Member Avatar for jimmymack

So I have a book on C but have Dev-C++ IDE and was wondering if I could learn C from that book whilst using the Dev-C++ IDE? Many thanks in advance!!

Member Avatar for TrustyTony
0
535
Member Avatar for helpfullProgram

Hello everyone! I have found a really weird result when I display a 2D texture (with GL_QUAD) on the screen at a different size to what it normally is: E.G when I display a 64x32 image(texture) on the screen at 128x64 and it contains an alpha channel the pixelated borders …

Member Avatar for helpfullProgram
0
258
Member Avatar for jimmyo88

[CODE]void EmployeeSearch() { vector<string> file; string temp; ifstream infile("GROUP.txt"); while( !infile.eof() ) { getline(infile, temp); file.push_back(temp); } // done reading file infile.close(); string item; cout << "Enter an employee number to delete from the file: "; getline(cin, item); for(int i = 0; i < (int)file.size(); ++i) { if(file[i].substr(0, item.length()) == …

Member Avatar for jimmyo88
0
235

The End.