# Search:

Type: Posts; User: 0rion

Page 1 of 7 1

1. ## Thread: string reversion using recursion

by 0rion
Replies
4
Views
1,914

### Close try, but you don't necessarily need to...

Close try, but you don't necessarily need to return anything on the reverse function as you can just modify the array inside the function and it'll be affected in the main function. You can reduce...
2. ## Thread: finding path in directed graph

by 0rion
Replies
7
Views
10,490

### It's rather simple due to the directed acyclic...

It's rather simple due to the directed acyclic nature of the problem we are guaranteed no cycles in the graph. Hence a simple DP algorithm suffices. We first define the DP state to be:

F(x) = the...
3. ## Thread: how to sort ?

by 0rion
Replies
6
Views
1,068

### [ #include #include ...

[

#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

vector< pair<int,int> >arr;
4. ## Thread: finding the second maximum.

by 0rion
Replies
6
Views
1,450

### Alternatively if you are required to retrieve the...

Alternatively if you are required to retrieve the n-th largest number - sorting is an option. Just sort and iterate through on the sorted list.

by 0rion
Replies
8
Views
1,209

### Not sure if this will help but try placing the...

Not sure if this will help but try placing the function inside namespace std.

by 0rion
Replies
13
Views
1,302

### Well 110*110 = 12100 basic operations (I'm...

Well 110*110 = 12100 basic operations (I'm assuming the inner loop doesn't do much though), which is hardly much for a modern computer. Try doing at least 5 million basic operations and the std::cout...

by 0rion
Replies
17
Views
1,525

### This is platform dependent issue - you need to...

This is platform dependent issue - you need to turn it off in a terminal/shell or using a system-dependent function.
8. ## Thread: Lowest Score Drop

by 0rion
Replies
16
Views
4,158

### Ah okies - I snipped the code out for the time...

Ah okies - I snipped the code out for the time being :)
9. ## Thread: Lowest Score Drop

by 0rion
Replies
16
Views
4,158

### Of course you can use STL functions to simplify...

Of course you can use STL functions to simplify them - but then he won't learn how loops are used :)
10. ## Thread: Help with math program...

by 0rion
Replies
9
Views
1,354

### #include #include #include...

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

void print(const vector<int>& vec) {
int table[26];
memset(table,0,sizeof(table));

by 0rion
Replies
3
Views
1,002

### #include #include #include...

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
string text, search, replacement, res;
getline(cin,text); getline(cin,search);...
12. ## Thread: Lowest Score Drop

by 0rion
Replies
16
Views
4,158

### Snipped ;) Note you still need to modify...

Snipped ;)

Note you still need to modify this. Notably in the calcAverage() function - you wanted the top 4 however in this case it gets the average of all the inputted scores. Also, if you want...
13. ## Thread: Maths Programming Help

by 0rion
Replies
8
Views
1,090

### #include using namespace std; int...

#include <iostream>
using namespace std;

int main() {
int n = 8;
while ((n+17)/(n-7) >= 2) {
if ((n+17)&#37;(n-7) == 0) cout << n << "\n";
n++;
}
return 0;
14. ## Thread: processing dynamic arrays

by 0rion
Replies
9
Views
1,408

### Not sure if you are asking if you can do it...

Not sure if you are asking if you can do it without creating a "dynamic" array or not, but in case you are asking if you can do it via a static array you can simply just do:

#include <vector>...

by 0rion
Replies
3
Views
967

### Expanding upon what ZuK said, basically the...

Expanding upon what ZuK said, basically the access control level determines the access levels for the derived class.

So if you want all the access levels to be the same as what is in the base...
16. ## Thread: Using reverse iterators in algorithms

by 0rion
Replies
1
Views
4,419

### Using reverse iterators in algorithms

Hey, I've been having some trouble with getting reverse iterators to work along with the standard algorithms. Since they only accept a normal iterator I can't do any computation using a reverse...

by 0rion
Replies
6
Views
1,001

### I would probably try and create another function...

I would probably try and create another function that converts hex to decimal that takes 2 characters and returns back the decimal value. You could use a mini-symbol table to link up 'A' to 10, 'B'...

by 0rion
Replies
6
Views
1,001

### You need to use a loop to traverse through the...

You need to use a loop to traverse through the string and extracting 2 characters until it reaches the end of the string.
19. ## Thread: Constructor Initialiser List

by 0rion
Replies
5
Views
1,281

### Hmm I'm still slightly confused, wouldn't...

Hmm I'm still slightly confused, wouldn't "strm(is)" call the constructor which takes a single std::istream argument (i.e. direct initialisation)? At the moment I can't visualise it properly (still...
20. ## Thread: Constructor Initialiser List

by 0rion
Replies
5
Views
1,281

### Constructor Initialiser List

Ok, I'm having a weird problem with getting my code to compile. The compiler (g++) keeps telling me that the "copy constructor" is private and gives me "error: within this context". Here's my...
21. ## Thread: Echoing a File

by 0rion
Replies
2
Views
1,042

### Thanks that cleared it up totally :)

Thanks that cleared it up totally :)
22. ## Thread: Echoing a File

by 0rion
Replies
2
Views
1,042

### Echoing a File

So I wanted to echo a file into standard output through the use of stream iterators, but I encountered an unexcepted output when I used strings compared to characters. Here's my code with chars...

by 0rion
Replies
3
Views
978

### Ahhhh! I didn't see it coming! :( *hides in the...

Ahhhh! I didn't see it coming! :(

I quickly coded it so I didn't pay much attention to the variable names as I just wanted to learn the maps! Thanks for the input.. guess I...

by 0rion
Replies
3
Views
978

### Mismatching parameters

I'm having a small problem with "matching up" the function definition/prototype with the function definition. I've stared at the code for ages already and can see no clue in where I'm at fault. The...
25. ## Thread: incrementing an array as formal arg

by 0rion
Replies
5
Views
2,324

### char *b[3]; b is an array of 3 elements of...

char *b[3];

b is an array of 3 elements of character pointers. If you use 'b' you really mean
the address of the first element (i.e. &b[0]). When you attempt to use b++,
you are telling the...
Results 1 to 25 of 175
Page 1 of 7 1