General C++ Programming - September 2017 (Page 3)

Bubble sorting of an random array
 
Was trying to make sorting of array using bubble sort method. Everything works fine except one thing, biggest number doesn't appear in sorted array, but instead...
[3 replies] Last: Thank you! Everything works just fine now. (by vsvld18)
Homework Help
 
I'm doing an assignment for my C++ class where I am encrypting data from a file using the Caesar Cipher shift method where the character is shifted three places...
[2 replies] Last: Off topic and not a big deal, but this caught my eye: [code firstline... (by doug4)
Pointer and arrays
 
Please refer to the below code Please explain me the line : short* end = a + SIZE; end is a pointer variable which holds address. a is the address of a . But ...
[6 replies] Last: But please explain what is happening in It is actually equivalent. ... (by coder777)
reversing a for loop
 
Hey Guys! I have this for loop with this following data 79927398713 and it isn't working for (i = size -1 ; i <=0; i = i - 2) { } i have to ignore the la...
[4 replies] Last: Your original post was far from clear. #include <iostream> #include ... (by lastchance)
error value type cannot be assigned to entity type
 
I am getting this error message: error value type cannot be assigned to entity type. Here is my function call: head = data(head); Here is my function hea...
[1 reply] : When asking for help with broken code, it is extremely important to po... (by mbozzi)
white space/formatting
 
So when i input this: Acme Software, Inc. 1000 45.50 56.90 i'm supposed to get: Company: Acme Software, Inc. Shares: 1000 Purchase/share: $45.50 Co...
[1 reply] : Just add a space in the output format: printf( "\n\nGain or loss: $%... (by Duthomhas)
by kg1020
back to back input and output to stringstream
 
Below code is not working as expected. stringstream ss; int n; ss<<"12"; ss>>n; cout<<n<<endl; ss<<"45"; ss>>n; cout<<n<<endl; Output: 12 12 Exp...
[3 replies] Last: Thanks Chervil (6904) (by kg1020)
Convert dollars to euros, pesos, etc.
 
I need to convert 100 dollars to pesos, yens and euros. One US dollar maps to 18 Pesos, 0.89 Euros, and 111.28 Yen. it need to be in a table, with a width of 1...
[5 replies] Last: You need to create some numbers to output, right? So they're going to ... (by Repeater)
basic_istream problem to create cin and wcin template
 
I am trying to code OpenCin function that will open cin ili cwin in the function whether we deal with chars or w_chars. template <class T> basic_istream<T, ...
[3 replies] Last: CHAR_TYPE is the character type. CHAR_TYPE{} is an anonymous tem... (by JLBorges)
Should I create a main.h?
 
When I examine the source code of large programs on github, the first thing I always find before the main function is a long list of preprocessor directives. ...
[2 replies] Last: > Would it break anything if I put everything before the main function... (by JLBorges)
by soby96
OCCURENCES IN ARRAY
 
write a program to create an array and fill it up with 20 randomly generated integers (range 0–10) and output the array. Write a function to implement fo...
[2 replies] Last: THANK YOU! your "pseudocode" was helpful. I was apparently thinking wa... (by soby96)
I cant figure out the program for this question.
 
Kathryn bought 750 shares of stock at the price of $35.00 per share. A year later she sold them for just #31.15 per share. Write a program that calculates and d...
[7 replies] Last: Look at: http://www.cplusplus.com/doc/tutorial/variables/ To displa... (by keskiverto)
Aligning Numbers
 
I am converting a number given by the user to hyperbolic functions, I have the code written I just need help aligning the numbers. Everything is fine until I en...
[1 reply] : #include <iostream> #include <iomanip> #include <string> #include <cm... (by lastchance)
cin problem
 
hey ı tried to work this code #include <iostream> using namespace std; int main() { string name; int age; string Lname; cout << "Enter...
[3 replies] Last: its really easy u just make like this a simple program #include <i... (by xXrandomryzeXx)
Indicating end of an array
 
I'm doing this program that has to read an array of digits of 20, when the user enter -1, thats the end of the array i.e 54251801 -1(end of array). also the ...
[6 replies] Last: Hey thanks heaps, i realised i was skipping something. SOLVED!! (by haddaauk)
grading test
 
Hello I need help with this program. I am having a problem getting my lowest and highest score to be omitted and only listing the other eighteen as used. I am ...
[3 replies] Last: Those instructions are not entirely clear, but it looks like you are b... (by Duthomhas)
Enter twice to stop program
 
How do i make my program stop only when it has scanned two blank lines with getline(cin,input);. Right now it stops after enter is pressed as input but i need i...
[2 replies] Last: Press Enter twice to terminate input: http://www.cplusplus.com/forum/b... (by Duthomhas)
Variables not passing too function, help!
 
Hello all, I'm working on a calculator program for complex numbers, and all my functions are working properly with the exception of my swap function. The idea ...
[1 reply] : do you know about operator overloading? it is a lot more mathy and pre... (by jonnin)
need program help with the Constructor
 
Write a class named Employee that has the following member variables: • name. A string that holds the employee’s name. • idNumber. An int variable tha...
[7 replies] Last: It's not clear what help you're asking for at this point. Did you not... (by AbstractionAnon)
efficient std vector I/O (.mat format)
 
Hello People, I have written a pear of templates in order to write and read std vectors in and from a Octave/Matlab compatible (.mat) files. This is the cod...
[4 replies] Last: Wow! what a code JLBorges! buffering tends to be slow You are righ... (by dariodem)
September 2017 Pages: 12345... 11
  Archived months: [aug2017] [oct2017]

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