48,985 Topics

Member Avatar for
Member Avatar for Daywalker46410

I apologize up front; I'm a VB Programmer trying to pick up C++. I have a very simple program that takes a string input from the user. How can I look at a specific character in that string? VB has the Left(), Right(), and Mid() Functions. Is there something similar …

Member Avatar for Narue
0
3K
Member Avatar for steosaur(oWn)

i have a vector initialized without a size. vector<int> Vector1; i initialized the first 5 values via .push_back() and i am supposed to do this next: Externally initialize(using a single cin statement) the next four items to: 50 65 77 32760 This doesn't seem to work: cout << "Enter these …

Member Avatar for Narue
0
718
Member Avatar for tat2dlady

Can anyone help me with this snippet of code? I have 2 files, a random record containing random records in it and an index file, which contains the binary tree of the random record. Here is what the index file looks like: 123456720 4 -1 -1 123456708 6 -1 -1 …

0
46
Member Avatar for kittie

This program is calculating and displaying the average of 3 groups of numbers in output file. Data is arranged in file so each group of numbers is preceded by number of data items in each group. It works for 2nd & 3rd group but calculation for 1st group is wrong. …

Member Avatar for kittie
0
170
Member Avatar for amarigny

Hello, I am studying C++ at Uni and my coding is not very strong. More to the point I am having issues with my header taking in this string. The code works in a linear non object oriented code but as I am new to data abstraction I as mentioned …

Member Avatar for amarigny
0
195
Member Avatar for silicon

Hello, I was hoping that someone could help me with this question. We received an extra credit queston which completely bombed on. That wasnt the problem, the problem was that I still cannot explain the questions below and since this was extra credit the professor would not give us the …

Member Avatar for silicon
0
175
Member Avatar for kparnell

I got this assignment to do, but i cant so it, i have tried everything i know in C++ programming and its not working. Can someone help me please. Write a Graphical User Interface program that simulates the activities of a vending machine. The program should allow for full user …

Member Avatar for eagleeye
0
132
Member Avatar for Tetsu

Well I got the password code right, I think. I have a few problems 1) it wont close properly 2) Can someone point me in the right direction to find a tutorial that teach me how to only let the user have 34 tries before it close and also to …

Member Avatar for Tetsu
0
139
Member Avatar for Precis

So I need to write a program that requires getting data from an input file (first name, last name, Student ID, and 4 test grades) and create an outputfil with the first and last names and ID, and then the average of the grades and the final letter grade - …

Member Avatar for marinme
0
149
Member Avatar for bobr_1013

How can I use "cin" to allow entry of an enum type in C++? My code is as follows: enum Cards {TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE}; Cards hand1 = ACE, hand2 = ACE; cout<<"Player#1 - Pick a card (2 - A): "; …

Member Avatar for Narue
0
8K
Member Avatar for Layla_2401

Hi all, I have a C project consisting of five files as follows: main.c file1.c file1.h file2.c file2.h I have defined an array in file [B]file1.h[/B] as follows: [CODE]static struct prnc keys[MAXP];[/CODE] the array was populated in file [B]file1.c[/B] Now I need to use the contents of this array again …

Member Avatar for Narue
0
217
Member Avatar for JoBe

Hello ladies and gents, Ive got this example of a program that I tried out wich shows some special possibilities to use new. [code] #include <iostream> using namespace std; int main() { int a[100]= {0}; for (int i = 0; i < 100; ++i) a[i] = 100 * i; int …

Member Avatar for Fasola
0
272
Member Avatar for winbatch

What's the difference between a set and a map? (As described below on cppreference) Set: The C++ Set is an associative container that contains a sorted set of unique objects. Map: C++ Maps are sorted associative containers that contain unique key/value pairs. I'm having trouble finding the distinction.

Member Avatar for Narue
0
616
Member Avatar for RobertH

i am after help with c++ builder any takers i need info on the registry adding and changing keys thanks in aticipation Robert

0
85
Member Avatar for apcxpc

I've got to implement Prolog in C++ for an assignment. I'm very new to C++, it's a little daunting. Also, I have no idea of where to start. Can someone point me to some basic algorithm and/or some resources online?

Member Avatar for apcxpc
0
381
Member Avatar for winbatch

Hi, I've been experimenting with STL on solaris with the 7.0 sun compiler. I am able to write programs using string, map, vector, list, etc. however, I am trying to use hash_map and can't get the most basic (ie hash_map<string,string> h; ) to compile. It appears that hash_map is not …

Member Avatar for winbatch
0
212
Member Avatar for pink

I want to write a program.This program is following: The two text file named file1and file2 each hold number of English sentences.A c++ program is required to carry out the following operations. a.)Give a wrod ,it lists how many times that word appears in file1 and file2. b.)list all the …

Member Avatar for Narue
0
91
Member Avatar for csi_a_m

I am trying to close this file so that it stops reading the array twice. i have placed it in different places but i does not seem to work, please look at my code and advise me on were to place the infile.close() Thanks in advance [code]#include <iostream> #include <fstream> …

Member Avatar for Dave Sinkula
0
155
Member Avatar for Fasola

I kind of know the definition through studying Java.] Inheritance is like when a child class inherits some value, object, or function from a parent class, right? I need an example of how its done in C++

Member Avatar for wilsonian
0
402
Member Avatar for XxAndyxX

Okay, this is driving me insane... The compiler error I'm getting says I am trying to convert a void to an account? I don't see why it thinks I'm trying to do that... Maybe you guys can help me out. [CODE] void get_accounts(account a[], int n); int add_customer(account a[], int …

Member Avatar for Dave Sinkula
0
163
Member Avatar for ckrieger1

I need help. I keep getting a Bus Error when I run my program and I've narrowed down where it occurs to the following code fragment. px0c0 and px0c1 are type double pointers and count_x0c0[m] and countc0 are integers. Can anyone see why this code would be giving me a …

Member Avatar for Fasola
0
263
Member Avatar for XxAndyxX

I'm wanting the program to read a line out of file. I wish c++ had .eoln()! I get: test.cpp:10: no match for `std::ifstream& != char' operator obviously because I'm comparing the wrong data types. [QUOTE] #include <iostream> #include <fstream> using namespace std; int main () { ifstream infile("test_file.txt"); while(infile!='\n' && …

Member Avatar for Dave Sinkula
0
9K
Member Avatar for hopeolicious

Can someone help me to make my program sort according to the average gallons used per car I keep geting 30 - 40 error when i try to compile it. Also my files do exist. [CODE]#include <fstream> #include <iostream> #include <iomanip> using namespace std; const int MAXCARS = 12; float …

Member Avatar for Dave Sinkula
0
152
Member Avatar for notbunny

I'm kind of lost. I'm trying to find the mode value in the list. All list are stroed in array. Anyone has any idea?

Member Avatar for notbunny
0
109
Member Avatar for tyczj

i cant figure this out, here is what im suppose to do Create a text file containing the pertinent information for the following table(not the identification row): [code]Employee No. Department Pay Rate Exempt Hours Worked 101 41 8.11 Y 49 722 32 7.22 N 40 1273 23 5.43 Y 39 …

Member Avatar for Dave Sinkula
0
174
Member Avatar for mel2005

hello am in need of some help on question 7 and 11, if someone has time please also try question 15. i really don't have any idea how to do the following question, and i need to have this assignment in soon. could you please try. thank you (7) allows …

Member Avatar for marinme
0
269
Member Avatar for ellas747

I have this code that I started on but cant seem to finish it. i have to create an file and put the outcomes in it. I cant seem to figure it out. can soemone please help. thanks, john [code] #include <iostream> #include <fstream> #include <cstdlib> #include <ctime> using std::cout; …

Member Avatar for ellas747
0
180
Member Avatar for banbangou

Anybody can help to explain why "m_line.replace(idx, m_search.size(), replace);" doesn't compile in cygwin and how to change it? Thanks. [code] using namespace std; int main(int argc, char *argv[]) { assert(argc==3 && "Usage: <searchstring> replacestring> to process stdin"); string m_line; string m_search(argv[1]); string m_replace(argv[2]); assert(m_search!=m_replace); while(getline(cin, m_line)) { while(true) { string::size_type …

Member Avatar for banbangou
0
119
Member Avatar for dazzer143

i'm having a trouble getting this right .. Write a program to calculate parking fee for customers who park their vehicles in a parking lot when the following information is given: The time the vehicle entered the lot (in 24-hour format, without a colon, such as 1645) The time the …

Member Avatar for peter_budo
0
214
Member Avatar for Ghost

Hi, I was wondering if there is a way to control hardware in C++, such as opening and closing a CD drive. Thanks in advanced, C++

Member Avatar for Ghost
0
804

The End.