General C++ Programming - April 2018 (Page 14)

Flipped numbers
 
#include <iostream> #include <iomanip> using namespace std; int main() { int i, row_nr; cin >> row_nr; for (i = 1; i <= row_nr; i++)...
[2 replies] Last: I want this code to give the result 1 4 7 2 5 8 3 6 9 now it gives m... (by Mr potato19)
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...
[9 replies] Last: No sweat. Good luck! (by tpb)
Counting vowels from a text file
 
I think my counting is fine and solid, but I'm still new to importing text from files. If someone could point out and explain what needs to be change that would...
[1 reply] : The name of the language is C++ and yet you still write C += 1 !? Wha... (by tpb)
MUD (reading in txt file)
 
I'll probably have more questions later on but I know I need some kind of loop to read in the particular things in the txt file, I just don't know how its suppo...
[1 reply] : What is the "javascript:tx" about? Post the first 50 lines of that fi... (by tpb)
Calling Contructor With Params outside function scope
 
This thing wont let me compile : class Foo{ public: Foo(); ~Foo(); private: Bar b(0, 0); // this ...
[1 reply] : * What compiler are you using? * What's the definition of Bar? * What'... (by helios)
to_string error
 
I am writing a code and I am getting an error of to_string was not declared in this scope. Does anyone have any idea how to fix this? string my_to_string(){ ...
[16 replies] Last: I'm not sure what you mean. You have to create the input file if you w... (by Ganado)
arrays
 
Help with arrays
[3 replies] Last: It's critical to indent your code so that it matches the actual block ... (by dhayden)
Permutations with specified sample space
 
I have 10 objects and I want to choose 5 from these objects and repetition is allowed. The permutation equation for that is 10!/(10-5)! which will give me all t...
[4 replies] Last: #include <iostream> #include <vector> #include <string> using namesp... (by lastchance)
Matrix
 
#include <iostream> #include <iomanip> using namespace std; int main() { int i, rows = 0, row_nr; cin >> row_nr; for (i = 1; i <= 9; i++) { ...
[1 reply] : your loop boils down to: for i = 1 to 9 cout i with an end of line e... (by jonnin)
by stav
constexptr to calculate something at compiletime
 
Hi I looked up a way to check the endianness of the system and found this snippet of code: bool is_big_endian() { union { uint32_t i; cha...
[1 reply] : Will it then calculate the endianness at compile time? instead of run... (by Ganado)
Flipped numbers Print out some numbers
 
CAN SOMEONE HELP ME WITH THIS? User inputs an integer N from the range from 1 to 30. Write a program to display the numbers from 1 to N*N in a table with...
[3 replies] Last: Your code has an array that has 3 rows and 3 columns. Your loops, howe... (by keskiverto)
Overlap percentage
 
On XY plane, you are given upper left corner coordinates of two equal sized rectangles. Find the intersection percentage of the rectangles. Question: Write a...
[2 replies] Last: All that I wrote in your first thread http://www.cplusplus.com/forum/g... (by keskiverto)
Counting magic numbers
 
This is the revised version of the problem. Resubmit your work here. Given two integers N and K, such that N>0 and N>K, count those numbers from the range o...
[1 reply] : All that I wrote in your first thread http://www.cplusplus.com/forum/g... (by keskiverto)
by Foxydf
Table Access
 
I am wanting to create a table of iRval and rs values so if a key corresponding to iRval is pressed the an answer of rs is given instead of all these if stateme...
[1 reply] : One idea is to use std::map. http://thispointer.com/stdmap-tutorial-pa... (by Thomas1965)
by louish
do while loop needs help.
 
Need help with it. The while loop for play again doesn't work. I am not sure what is the reason that caused the error, any suggestion will be helped. The ide...
[4 replies] Last: Duplicate of http://www.cplusplus.com/forum/beginner/234497/ . Please... (by MikeyBoy)
C2601
 
I am working with the following pseudocode: Using the pseudocode below, write the code that will meet the requirements. Declare constants SIZE and MIN Functio...
[4 replies] Last: http://www.cplusplus.com/reference/cstring/strlen/ (by MikeyBoy)
Function to convert lowercase s to uppercase in string(without #<algorithm>)
 
So I need to write a function to convert all lowercase character s's to uppercase and leave all other characters unchanged. Then return the transformed string. ...
[1 reply] : You can just use a for loop and use islower and toupper. #include <cct... (by Thomas1965)
by nonus
Assistance with looping variances
 
Hello, I am trying to write a program that does sum, total & average, along with comparing numbers of being the highest and lowest. I've succeeded in do so, but...
[1 reply] : indent your code > but I'm having problems doing the Do-While. ¿wha... (by ne555)
when and why use explicit?
 
i'm sorry, but i fill much more confused :( what is explicit and when use it? i read some information and i tested, but i'm felling more confused :(
[5 replies] Last: thank you so much for all to all. now i understand more about explicit... (by Cambalinho)
April 2018 Pages: 1... 121314151617
  Archived months: [mar2018] [may2018]

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