Beginners - March 2018 (Page 12)

by Cp9
string accepting only numbers
 
How I can check if credit card numbers contains only of numbers? # include <iostream> # include <string> # include <iomanip> using namespace std; ...
[2 replies] Last: if ( creditCard.find_first_not_of( "0123456789" ) == string::npos ) c... (by lastchance)
How to access the last character in an element of string array
 
I am provided with a coded message, a definition list, and asked to write a program to translate the message. And the definition list looks like this: A =...
[2 replies] Last: Sorry about that. Here's the code. It's pseudocode though because I do... (by knguyen2081)
How to replace NaN values in text file? (1,2)
 
I'm fairly new to C++ programming and I am working on my first project. The current issue I am facing right now is that after I read in my file, the data in the...
[22 replies] Last: The following is in order of columns: Square ID(GRID ID), Time Interva... (by nicholasjb1996)
Square root
 
i need help finding square roots without the math library. what im using is this //square=total length of 1d array void uMatrix::sqrt(int square) { ...
[1 reply] : root = ((root + square) / root) / 2; Slightly wrong. The Babylonian... (by Ganado)
by zapshe
std::cin and whitespace - not consistent?
 
Alright, I've been having a weird experience with std::cin - hope someone can clarify things for me. std::cin doesn't accept white space as part of the input. H...
[5 replies] Last: Thanks Peter, that looks pretty handy, I'll make sure to remember it f... (by zapshe)
question about maps
 
i have a question about maps, im working on a spell check i have load dictionary which is going to be a set, and i have that correct, but for the map part im co...
[1 reply] : I'm not sure if a map would be the best option for a spell-checker, I'... (by Ganado)
Trouble using an input facilitator function to read a list with tabs.
 
Working on a small ungraded assignment for my class and have stumbled upon a problem. We are suppose to be using a facilitator input function (see below) to rea...
[4 replies] Last: If a string contains space you need to use getline with '\t' as delim... (by Graff527)
Mail Order type application
 
I'm trying to do an application that allows the user to enter a 4-5 character string consisting of a number, two letters that determine the output, and then 1 o...
[6 replies] Last: So I should be using ==? (by Databend)
what excactly are atrributes in a class?
 
so we got a assignment from school and we have to create a class but I don't quite understand what they mean with attributes. [ #include <iostream> class F...
[1 reply] : Hello king2105, PLEASE ALWAYS USE CODE TAGS (the <> formatting button... (by Handy Andy)
by pevecg
Setting value to dynamic class object
 
Hello, so I am playing around with classes and I pretty much understand them apart from the fact how do you set a value to dynamic class object. void Account...
[1 reply] : Nevermind, I realized that when testing this, I didnt initialize the a... (by pevecg)
by pizza
Why Pass String By Reference
 
Hello. I learned that when you pass something by reference not by value, the program doesn't make another extra copy which makes my program efficient and, whate...
[12 replies] Last: Even without threads, the function may not be able to assume that the ... (by helios)
Verifying correct input
 
I'm creating a program that requires the input to contain a certain parameter, that being 3 digits followed by a hyphen, and then two more digits. I cannot find...
[2 replies] Last: Thanks! Works perfectly. (by Databend)
by Fojaxx
Prevent characters from being entered into int variable type
 
Hey, so i spent all yesterday working on a ratio calculator for purchasing items. the program takes a given budget limit, takes a number of inputs (1-10) rep...
[8 replies] Last: In most cases, the best (simplest, most straight-forward) way to valid... (by mbozzi)
Visual Studios c++ Square Matricies
 
i am having trouble creating a square matrix with my code. I am not allowed to use the vector library or the math library. I am restricted to iostream and fstre...
[3 replies] Last: Your question is not entirely clear. On one hand you talk about some ... (by keskiverto)
what excactly are atrributes in a class?
 
I have been googling for 2 hours and I still don't know what an attribute is in a Class. could someone give me an example? I am familiar with other aspect...
[1 reply] : https://stackoverflow.com/questions/18282330/c-is-it-correct-to-call-c... (by d1g1talarts)
Vector loops
 
Im not sure why vector d is only getting the "dog" string and not the "catd" string as well. /**********************************************************...
[5 replies] Last: std::string::npos http://en.cppreference.com/w/cpp/string/basic_string... (by closed account E0p9LyTq)
functions and array
 
my codes not working #include <iostream> #include <string> #include <iomanip> using namespace std; // Function Prototypes // These prototypes alrea...
[1 reply] : not working Please describe that in more detail. * Fails to compile?... (by keskiverto)
by urby
Why does the output value always equal 1?
 
Hello, I am sorry for a basic question, however, I can not figure out why this function obtains the value of 1 for n. Here is the function: int a = 0; in...
[6 replies] Last: Thank you for finally showing the relevant code. A compiler says: I... (by keskiverto)
Count the average from an external textfile. (containing strings)
 
Hey, Im trying to make a program with an external .txt file. It should contain First name, last name and the age of the persons. Then get the info from the .tx...
[8 replies] Last: Thank you! you´re the best! I have to study more.. (by dannehess)
How to use to_string function
 
I am creating a function that takes two integers and adds them returning as the string "a + b = c". I have to use the to_string function and it only seems to re...
[1 reply] : #include <iostream> #include <string> std::string addition( int a, ... (by JLBorges)
March 2018 Pages: 1... 1011121314... 29
  Archived months: [feb2018] [apr2018]

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