General C++ Programming - November 2019 (Page 2)

by cgm2k7
Read content from a text file
 
Hello good day! I have a hard time if anyone can help me thank you: It is as follows, I have a text file with the following lines: name = idle w = 60 h =...
[1 reply] : Open file: ifstream file ("some_file.txt"); Get first word ("name"... (by Repeater)
I'm trying to add the values stored in an array.
 
its printing a big negative number. #include <iostream> #include <string> #include <iomanip> #include <fstream> using namespace std; struct ventasType { ...
[4 replies] Last: Or that they don't pay attention to what is being said. https://www.dr... (by salem c)
why i can't use auto on typedef?
 
why i can't use the 'auto' on typedef?
[17 replies] Last: Peter87 that's a good point too. thank you (by Cambalinho)
Reading in imaginary numbers
 
Hi, I'm trying to figure out how to do the first part of this problem. Here is the instructions: /* Given the following class; write the implementation code...
[1 reply] : for c++ complex type, its simple enough: complex<double> p; cin... (by jonnin)
.c_str() Error
 
I'm getting an error when using .c_str(). The error is "left of '.find' must have class/struct/union". Can someone help me? I've included the .cpp code but n...
[6 replies] Last: Thanks for the suggestions. My instructor ended up helping me; I'm pr... (by terina00)
by Tawwy
How To Work Out This Part
 
I created the 3 functions already but I'm not sure how to do these two parts of the question. PART 1: Read all the data in the temp.txt file and store the mi...
[5 replies] Last: So post what you have so far. (by salem c)
vectors: how create and initializate multidimensional? (1,2,3)
 
how we initializate a multidimensional vectors? we can do: vector<int> vec{3,4,5}; but we can't do these for 2D: vector<int> vec{{3,4,5},{0,6}}; what y...
[42 replies] Last: i will create a new topic, because of the next question ;) thank you s... (by Cambalinho)
Template version of merge sort
 
Hi there, How do you create a template version of the merge sort below? Many thanks in advance. #include <iostream> using namespace std; // A funct...
[1 reply] : First up, fix this illegal C++: int temp[high-low+1]; cin>>n; int... (by Repeater)
Unintentionally, each score does not come out, but the combined score comes out.
 
What I wanted to do was take 10 arrays of structures and get the number of each array of structures. For example, entering love would get 12 + 15 + 22 + 5 = 54 ...
[4 replies] Last: Thank you so much for the answer I wanted. It was simple to think of i... (by somang317)
get the type to which a pointer points
 
How to retrieve/get the type to which a pointer points on compile time like t illustrated in: int *p; //.. //... t = p ; // ..? how make variable t is "int"...
[4 replies] Last: The compiler sees the code and so do you. While type info is available... (by keskiverto)
Needing help with this function and ->
 
I have been working on this assignment for class and need help I'm stuck on this function it inserts a word into my dictionary. I have that part down but what i...
[2 replies] Last: For some reason I thought I saw 'tree' not linked list. The above tre... (by jonnin)
How to combine fft and ifft function using class?
 
Hi, I am doing fast fourier transform(FFT) and inverse FFT (ifft) and I am using class in my code. Since I am dealing with Vivado HLS compiler, so I need to sp...
[5 replies] Last: @Nurulhuda, I don't understand your code, but if you want an FFT witho... (by lastchance)
C++ ELSE PROBLEM
 
#include <stdio.h> // Begin Main main () { // Define variables int num1 = 0; int num2 = 0; int result = 0; int choice = 0; // Pr...
[4 replies] Last: //... //... bool f=true ;//set flag if (choice == 1) { // Add num1... (by marhuum)
size_t is all about
 
What exactly is size_t all about compare to int , and what's their differences?
[2 replies] Last: std::size_t is just a fancy way of writing and explicitly telling th... (by malibor)
by Ric
Help with a program
 
I need help with creating a program that defines an array of five integers and a pointer to an integer. -The pointer needs to point to the beginning of the arr...
[9 replies] Last: #include <iostream> using namespace std; int main() { int a ; ... (by eyssant)
Print out size of array
 
I need to write a statement that will print out the size of the array. I have it to where it will print out just 0 but I need the size of the array. I can't cha...
[4 replies] Last: #include <iostream> using namespace std; int main (){ int MyAr... (by eyssant)
default of function alias arg.
 
Is there a way to set the default of function alias arg. so having option to be one or two argument of its each own purpose, without the way of overload multipl...
[1 reply] : note that in your code sample, second argument always exists, wether s... (by malibor)
How to output this on a table and also output if the subject is credited or not based on the input on the program
 
void input_grades(void) { clrscr(); string subj ={"CHN11","ESN111","EN111", "ESN110","FI101","MAN 111","PEN 1","MAN 112"}; for(int x=0; x<=8; x+...
[no replies]
Efficient way to search within unsorted array
 
I have an unsorted array A containing value within range 0 to 100. I have multiple query of format QUERY(starting array index, ending array index, startValue, e...
[3 replies] Last: Set up a vector< vector<int> > bucket( 101 ); Pass once through the a... (by lastchance)
selection sorting
 
hey guys, I am fairly new to c++ and I was trying to finish this code for my last lab. I've tried almost everything but some reason I can not get my numbers to ...
[4 replies] Last: Modify your main() function as below: int main() { const int size = 1... (by eyssant)
November 2019 Pages: 1234... 8
  Archived months: [oct2019] [dec2019]

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