Yup, that was it. I can't believe I didn't catch that.
Type: Posts; User: Sir Andus
Yup, that was it. I can't believe I didn't catch that.
Well, using a bubble sort and timing how long it takes is the point of this program, so using another one wouldn't really suffice.
Ok, so I got random to work, but my bubble isn't working now. It seems to be exiting the function before it does any sorting because I get the same order I had before the sort as I have afterwards. ...
int n = 10;
int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
So I change it to a static array but I still get the message:
[Linker error] undefined reference to `print(int*, int)'
Basically, I'm unsure of how to utilize the function rand(). All I want to do is create 20 random numbers, use a bubble sort on them, print the sorted list and the time it takes to sort it.
...
So I understand how templates work, but I don't understand how to use them in a main (or at least the syntax I need to use them).
#include <cstdlib>
#include <iostream>
using std::cout;...
But what does this mean?
I am having trouble getting my nested structs to print. I want the phone struct to print, but I'm not quite sure how to format it. I'm thinking it's what I did when I actually created the struct,...
Ok, so I've improved the structure of the program so that it finally makes sense, but I'm still having a run-time error. It gets to the first printf statement, but then the window suddenly crashes....
This is what I was hoping to illustrate but I guess it didn't work out so well.
Anyways, thanks for the help so far! One the bright side, my lastest build can atleast compile now. The only...
I've been trying to manipulate strings as of recently, but with very little success. The program I've been working on is supposed to take a predetermined string and remove the character indicated. ...
Ok, everything is in working order except for the EOF occuring before the sentinel value message. Since I call the read_eles function twice, the second time it calls it, the sentinel value has...
For this, I was supposed to build a program that read arrays from pointers instead of subscripts. At the highlighted location, I was having an error that said: [Warning] initialization discards...
Wow, I feel kind of stupid now for missing that. Thanks a lot though.
I'm not sure what I'm doing wrong, but there seems to be some problems occuring before the print function. The only times it will print the values is if the array is full yet it still has some...
I've been working on this project for my class for a few days now, but I can't seem to figure out one thing; how to flush non-numerical input. The program is supposed to error check this, but I...
As of lately, I've been just messing around with C++ just basically trying to grasp how to do various tasks with it. Earlier this week, I decided to write a program that had to do with the quadratic...