Beginners - April 2018 (Page 20)

Proper use of ifstream and Funtions
 
This is the code I've attempted to use: /************************ Purpose of the Program: Read an input file for gene information and sort the informatio...
[3 replies] Last: It's kind of silly to have a function just to open the file. Instead, ... (by tpb)
Access to private class members
 
Hello there, I am a complete new beginner here. I am trying to load a .txt file which contains a few variables and display them. I am not sure how to access pri...
[10 replies] Last: string File; for (int i = 0; i < 4; i++) if (myfile >... (by keskiverto)
by abir50
what am i doing wrong here?
 
I am doing a project for class and since I am not allowed to share/post it so i made an example of the part that I am stuck on. Idk what i am doing wrong here.....
[5 replies] Last: damn i didn't even realized i had that, must have done it by accident,... (by abir50)
Vectors and Classes
 
Currently in c/c++ programming 2 and trying to expand my knowledge of classes and vectors and how they interact with each other. I'm experimenting with using a ...
[11 replies] Last: A free function is just a non-member function (outside of the class) ... (by jlb)
Should I used “dynamic allocating array” or “Vector”?
 
just read about Vector and it’s basically an improved array?
[2 replies] Last: Hello BambiWithPMS, Yes this is true. At its core it is still an arra... (by Handy Andy)
Ignore
 
Please ignore
[1 reply] : Please do not post multiple times. http://www.cplusplus.com/forum/beg... (by closed account E0p9LyTq)
Question regarding switches, I think.
 
This is a snippet of a program I'm working on. The idea is that it switches between active and not active every time a password is entered. Could you show me a ...
[3 replies] Last: I do not understand the necessity of bool if I can use int. Using ... (by closed account E0p9LyTq)
Delimiter not working
 
For a project I have to pass data from a file into an HTML code. The delimiter is not working (\t) instead of selecting all data between tabs, it selects only s...
[6 replies] Last: Hello aaronpeart, While I was playing with your program I realized th... (by Handy Andy)
by abir50
counting primes between 1 to x
 
Trying to get pi(x)=number of primes from 1 to x but i am totally lost after getting up to here. #include <iostream> #include <cmath> using namespace st...
[6 replies] Last: You should probably increment the count, not just assign 1 to it. (cou... (by Ganado)
What are strings?
 
I just started learning c++ without any previous experience in programming and i am quite baffled as to what strings actually do or where they are used.
[1 reply] : It's best to think of a string as a sequence of zero or more character... (by JLBorges)
by abir50
void test function
 
For a project i am asked to find primes from 1 to x and then use the number of primes to solve the Prime number theorem, which i did but prof doesn't want us to...
[3 replies] Last: This description matches the given output: // Loop i from 1 to n. In ... (by dhayden)
Problem with M_PI
 
Hello I need some help with this code. I got this expression: M = 4/3(p*pi*r^3) where p is a constant. pi is also a constant, and to define it I used M_P...
[2 replies] Last: oh! thanks helios ! (by bonecrunch)
c++ problems updated!
 
I think there is something wrong with my constructor. Can someone please help?? #ifndef INTEGER_SET_H #define INTEGER_SET_H class IntegerSet { priv...
[2 replies] Last: You need to set the A's elements to 0 in the constructors. Something l... (by tpb)
Reading file into a class array
 
For my homework assignment, I have to create a class titled "Book" and I need to read a file, of a max size of 2000 lines, line by line into the class type belo...
[5 replies] Last: since you have various types of data for a single book I would suggest... (by closed account NCRLwA7f)
How to use in.get() with text file
 
I'm writing a program that reads in words from a text file into a stack and queue to check if they are palindromes. Here is the text file: madam Madam I...
[5 replies] Last: I'm only to use characters, not allowed to use string type at all (by ElleJay)
C++ to Assembly code
 
hello everyone, does anyone know how I can start a c++ program and drop down to assembly code for a few functions and pick right back up to c++? so, for exam...
[2 replies] Last: yes, This is good, I didn't know what it was called....I was under the... (by closed account NCRLwA7f)
Counter returning 1 more than expected
 
This code counts all the names on a file. There are 26 names in the file, all on separate lines. However, the counter returns 27. #include <iostream> #includ...
[2 replies] Last: Yeah you were right there was an extra blank line at the end, thank yo... (by One Pea)
Add AI to Tic Tac Toe
 
Hey, I need to make it so that my Tic tac toe board is against the computer rather than against another person so can anyone help me with how I should edit my ...
[4 replies] Last: Also, try to make everything relative to the size of a side. I could ... (by icy1)
by Fishy
Why wont this very simple program with classes and files compile?
 
Why wont this very simple program with classes and files compile? This code is from a YouTube tutorial. I'm using Code:Blocks 16.01. The code has three files....
[4 replies] Last: I went back and watched things again including how he created projects... (by Fishy)
Having some linker problems with gcc...
 
Hello! I'm having some trouble getting my program to compile. The purpose of this program is: 1.) To generate hour/temperature values and store them in a ...
[4 replies] Last: also when you compile be sure to list all the .cpp names: g++ -std=c+... (by nether)
April 2018 Pages: 1... 1819202122... 25
  Archived months: [mar2018] [may2018]

This is an archived page. To post a new message, go to the current page.