48,985 Topics
|
|
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 … |
|
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 … |
|
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 … |
|
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. … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 - … |
|
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): "; … |
|
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 … |
|
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 … |
|
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. |
|
i am after help with c++ builder any takers i need info on the registry adding and changing keys thanks in aticipation Robert |
|
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? |
|
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 … |
|
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 … |
|
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> … |
|
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++ |
|
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 … |
|
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 … |
|
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' && … |
|
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 … |
|
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? |
|
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 … |
|
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 … |
|
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; … |
|
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 … |
|
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 … |
|
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++ |
The End.