Hi guys :) I need help with some OpenGL specific stuff (in C#)
Now that SFML isn't enough for me anymore, I'm using OpenTK.
I want to have animated 3D models in my game and I can already draw the non moving and non changing world from a VBO. But the thought of having to reupload stuff everyframe scares me a bit.
Do I really have to re-upload all vertices to the GPU again after one frame passed (and the model changed because of the animation) ?
What "usage hint" would be best when creating a VBO for an animated model ?
Is there some kind of trick to only re-upload a subset of vertices?
-
Also, whats a good general approach to reduce the amount of renderstate switches?
-
Is it better to have multiple VBOs, one for position of the vertices, one for texCoords, one for Color (if used), one for normals, etc... ?
Or would it be better to use an interleaved "all in one" buffer and then set it up with VertexPointer(), ColorPointer(), ... ??
Is the answer to this last question different whether I'm drawing static geometry or animated??
Hey C# beginner here
I know it's extremely simple and I have done it before but I cant for the life of me figure out how to convert the console readline to a float.
[quote]user.Height = Console.ReadLine();[/quote]
user.Height = Float.Parse(Console.ReadLine());
This will only work if the input is a string though, and in the correct format.
[QUOTE=Tovip;38425767]Hey C# beginner here
I know it's extremely simple and I have done it before but I cant for the life of me figure out how to convert the console readline to a float.[/QUOTE]
[CODE]
float a;
if (float.TryParse(Console.ReadLine(), out a))
{
//
}
[/CODE]
is this what you're looking for?
Maybe not the best solution as I'm also fairly new.
ninja
[QUOTE=CRASHFORT;38425866][CODE]
float a;
if (float.TryParse(Console.ReadLine(), out a))
{
//
}
[/CODE]
is this what you're looking for?
Maybe not the best solution as I'm also fairly new.
ninja[/QUOTE]
This is even better. To Tovip: this will try to convert it to a float, and if it fails it will return false in the if, giving you the chance to return some sort of error. The "out a" in this instance is the variable that is set to the float if it is indeed, a float.
I am messing around with classes in C++, and I have no idea what I'm doing wrong here. I have two classes, Node and Edge. You can see where I'm going with this. My code:
node.h
[cpp]#ifndef _NODE_H
#define _NODE_H
#include <string>
class Node
{
int x, y;
std::string label;
public:
Node(std::string, int, int);
int getX();
int getY();
void setX(int);
void setY(int);
void setPos(Node);
std::string getLabel();
void setLabel(std::string);
};
#endif[/cpp]
node.cpp
[cpp]#include "node.h"
#include <string>
using std::string;
Node::Node (string label, int x, int y)
{
this->label = label;
this->x = x;
this->y = y;
}
int Node::getX()
{
return this->x;
}
int Node::getY()
{
return this->y;
}
void Node::setX(int x)
{
this->x = x;
}
void Node::setY(int y)
{
this->y = y;
}
void Node::setPos(Node node)
{
this->y = node.getY();
this->x = node.getX();
}
string Node::getLabel()
{
return this->label;
}
void Node::setLabel(string label)
{
this->label = label;
}[/cpp]
edge.h
[cpp]#ifndef _EDGE_H
#define _EDGE_H
#include "node.h"
class Edge
{
Node a, b;
public:
Edge(Node, Node);
};
#endif[/cpp]
edge.cpp
[cpp]#include "edge.h"
#include "node.h"
Edge::Edge (Node a, Node b)
{
this->a = a;
this->b = b;
}[/cpp]
And I'm getting the errors:
[code]edge.cpp: In constructor ‘Edge::Edge(Node, Node)’:
edge.cpp:4:27: error: no matching function for call to ‘Node::Node()’
edge.cpp:4:27: note: candidates are:
node.h:12:5: note: Node::Node(std::string, int, int)
node.h:12:5: note: candidate expects 3 arguments, 0 provided
node.h:6:7: note: Node::Node(const Node&)
node.h:6:7: note: candidate expects 1 argument, 0 provided
edge.cpp:4:27: error: no matching function for call to ‘Node::Node()’
edge.cpp:4:27: note: candidates are:
node.h:12:5: note: Node::Node(std::string, int, int)
node.h:12:5: note: candidate expects 3 arguments, 0 provided
node.h:6:7: note: Node::Node(const Node&)
node.h:6:7: note: candidate expects 1 argument, 0 provided[/code]
If anyone could shed a little light on the situation it would be much appreciated. Thanks.
Facepunch ruined the formatting for a minute there.
[QUOTE=Duskling;38420571]How would I go about moving an object to a specific spot on the screen? In my entity, I have a position Vector2f, and a target Vector2f. I can't seem to find anything on the internet that helps me out with this.
EDIT:
Figured out how to do it, this is what I am doing:
direction.set((target.x - position.x),(target.y - position.y));
But when the entity gets close to the target, he starts slowing down. Is there a way to avoid this? I want him to go to the position at a constant speed. This is how I am moving the ent:
position.x += (direction.x * speed);
position.y += (direction.y * speed);
speed is .01f.[/QUOTE]
The problem is that you're not normalizing your direction vector. What this means is that if you're 100 units away from your target, you're gonna move there at a speed of (100 * speed), and when 50 units from the target, it will move at a speed of (50 * speed). Basically, the speed of the object is a function of the objects distance from its target. To eliminate this, you
It's very likely that your vector definition has a normalization function already that you can use, what this does is that it basically reduces the difference between the target and current locations to an actual direction.
By using the normalized vector, you'll notice that your objects move much slower overall, although now at a constant rate, so you'll probably have to increase the speed coefficient in order to get the intended movement.
Consider this graph:
[IMG]http://localhostr.com/files/Sd9LS7h/IMG_0051.JPG[/IMG]
First order of business, as you have already done, is to find the difference between the two positions, your target and yourself.
[cpp]Vector2f difference = Vector2f(target.x - position.x, target.y - position.y)[/cpp]Since we've situated ourselves at position (0, 0), the difference in position is obviously gonna be the same as the target location, that is (4, 2)
Next, we find the actual distance to the object, as the crow flies. For this, we'll use the Pythagorean theorem, seeing as we're dealing with a right triangle. The magnitude of the vector is denoted [I]m [/I]on the whiteboard.
[cpp]float magnitude = sqrt(difference.x^2 + difference.y^2)[/cpp]sqrt(4[SUP]2[/SUP]+2[SUP]2[/SUP]) is roughly equal to 4.47.
Now that we have the [I]difference [/I]and the [I]magnitude[/I] we can get the actual direction to our target by dividing the two like so:
[cpp]Vector2f direction = Vector2f(difference.x / magnitude, difference.y / magnitude)[/cpp]The x and y marked on the whiteboard are the two components of the direction vector.
The magic of this operation is that regardless of which direction the target is in relative to you, our direction vector will always have a distance of 1. This is why it's also called a [I]unit vector[/I], because it, like the [I]unit circle[/I] has a radius of 1.
I don't know if my description or drawing made sense, but I hope it did. It's kinda late here and I should really be sleeping, so if there's anything that needs to be cleared up, just post it here or PM me and I'll take a look in the morning :)
[editline]12th November 2012[/editline]
[QUOTE=nos217;38426127]I am messing around with classes in C++, and I have no idea what I'm doing wrong here. I have two classes, Node and Edge. You can see where I'm going with this. My code:
node.h
[cpp]#ifndef _NODE_H
#define _NODE_H
#include <string>
class Node
{
int x, y;
std::string label;
public:
Node(std::string, int, int);
int getX();
int getY();
void setX(int);
void setY(int);
void setPos(Node);
std::string getLabel();
void setLabel(std::string);
};
#endif[/cpp]
node.cpp
[cpp]#include "node.h"
#include <string>
using std::string;
Node::Node (string label, int x, int y)
{
this->label = label;
this->x = x;
this->y = y;
}
int Node::getX()
{
return this->x;
}
int Node::getY()
{
return this->y;
}
void Node::setX(int x)
{
this->x = x;
}
void Node::setY(int y)
{
this->y = y;
}
void Node::setPos(Node node)
{
this->y = node.getY();
this->x = node.getX();
}
string Node::getLabel()
{
return this->label;
}
void Node::setLabel(string label)
{
this->label = label;
}[/cpp]
edge.h
[cpp]#ifndef _EDGE_H
#define _EDGE_H
#include "node.h"
class Edge
{
Node a, b;
public:
Edge(Node, Node);
};
#endif[/cpp]
edge.cpp
[cpp]#include "edge.h"
#include "node.h"
Edge::Edge (Node a, Node b)
{
this->a = a;
this->b = b;
}[/cpp]
And I'm getting the errors:
[code]edge.cpp: In constructor ‘Edge::Edge(Node, Node)’:
edge.cpp:4:27: error: no matching function for call to ‘Node::Node()’
edge.cpp:4:27: note: candidates are:
node.h:12:5: note: Node::Node(std::string, int, int)
node.h:12:5: note: candidate expects 3 arguments, 0 provided
node.h:6:7: note: Node::Node(const Node&)
node.h:6:7: note: candidate expects 1 argument, 0 provided
edge.cpp:4:27: error: no matching function for call to ‘Node::Node()’
edge.cpp:4:27: note: candidates are:
node.h:12:5: note: Node::Node(std::string, int, int)
node.h:12:5: note: candidate expects 3 arguments, 0 provided
node.h:6:7: note: Node::Node(const Node&)
node.h:6:7: note: candidate expects 1 argument, 0 provided[/code]
If anyone could shed a little light on the situation it would be much appreciated. Thanks.
Facepunch ruined the formatting for a minute there.[/QUOTE]
In the constructor of Edge, it's trying to create 2 dummy nodes, because it doesn't know whether you're going to define them in the constructor or not, but since the only constructor for Node takes 3 arguments, it doesn't know how to initialize them.
What you can do, is use an initializer list, which were put there to solve this exact problem.
All you need to do is change your implementation of Edge::Edge to this:
[cpp]
Edge::Edge (Node a, Node b) : a(a), b(b)
{
}
[/cpp]
What this does is that it basically lets the compiler know how to construct the Node members when the object is initialized, instead of when the constructor is called. You should read up on initializer lists, because there's more to them than I could ever cover in a post like this.
Another solution would be to create a Node constructor that took no arguments, but I feel that that's the wrong choice in your case.
[QUOTE=ArgvCompany;38420112]I'm not sure how you can understand O(n²) but not O(n log n)? How would you describe what you think O(n²) is?[/QUOTE]
Like sorting an array because you have to go through an array with a length of n n amount of times so it's n*n or n^2? I was never taught that, I just picked it up by repeatedly seeing people mention it and I used context. I looked it up now and I see that o(n^2) does mention sorting but it's entirely possible that I came to the conclusion that it's o(n^2) for the wrong reasons and that I don't understand the concept at all in the first place. I just would like a resource to learn about it if possible. A book or website would be nice.
[QUOTE=Dr Magnusson;38426276]In the constructor of Edge, it's trying to create 2 dummy nodes, because it doesn't know whether you're going to define them in the constructor or not, but since the only constructor for Node takes 3 arguments, it doesn't know how to initialize them.
What you can do, is use an initializer list, which were put there to solve this exact problem.
All you need to do is change your implementation of Edge::Edge to this:
[cpp]
Edge::Edge (Node a, Node b) : a(a), b(b)
{
}
[/cpp]
What this does is that it basically lets the compiler know how to construct the Node members when the object is initialized, instead of when the constructor is called. You should read up on initializer lists, because there's more to them than I could ever cover in a post like this.
Another solution would be to create a Node constructor that took no arguments, but I feel that that's the wrong choice in your case.[/QUOTE]
Very interesting. Is this something new? I've been programming C++ for quite some time and I've never come across this problem before. I'm sure Accelerated C++ doesn't mention it. Thanks very much.
Initializer lists aren't new. You should learn how to use them.
This is frustrating, I thought I had a good handle on C++ and now I can't even implement a simple node/edge/graph structure.
Nevermind, I just realized that I should be excited about the opportunity to learn something new.
[QUOTE=Shadaez;38426347]Like sorting an array because you have to go through an array with a length of n n amount of times so it's n*n or n^2? I was never taught that, I just picked it up by repeatedly seeing people mention it and I used context. I looked it up now and I see that o(n^2) does mention sorting but it's entirely possible that I came to the conclusion that it's o(n^2) for the wrong reasons and that I don't understand the concept at all in the first place. I just would like a resource to learn about it if possible. A book or website would be nice.[/QUOTE]
Only skimmed through it, but should give you the idea I hope:
[url]http://stackoverflow.com/questions/2307283/what-does-olog-n-mean-exactly[/url]
I've spent hours on getting 2D textures to work in OpenGL.
Here's my code:
[url]http://pastebin.com/rWGq7gsM[/url]
When I run it, all I see is a fully-white quad. Did I make some obvious mistake?
Width and height are both 512.
[QUOTE=Natrox;38428083]I've spent hours on getting 2D textures to work in OpenGL.
Here's my code:
[url]http://pastebin.com/rWGq7gsM[/url]
When I run it, all I see is a fully-white quad. Did I make some obvious mistake?
Width and height are both 512.[/QUOTE]
Try setting the texture matrix to identity.
Also check if the texture is loaded correctly.
Do vertex colors work for you?
[QUOTE=Felheart;38428273]Try setting the texture matrix to identity.[/QUOTE]
The quad remains white.
[QUOTE=Felheart;38428273]Also check if the texture is loaded correctly.[/QUOTE]
The texture is constructed from m_Framedata which is filled with the value '0'. I would expect black.
[QUOTE=Felheart;38428273]Do vertex colors work for you?[/QUOTE]
They do.
[editline]13th November 2012[/editline]
The texture is created correctly. I've debugged it with gDEBugger.
[QUOTE=Natrox;38428396]The quad remains white.
The texture is constructed from m_Framedata which is filled with the value '0'. I would expect black.
They do.
[editline]13th November 2012[/editline]
The texture is created correctly. I've debugged it with gDEBugger.[/QUOTE]
Disable all features you don't absolutely need before drawing:
(GL_DEPTH_TEST, GL_CULL_FACE, GL_ALPHA_TEST)
Also what vertex colors did you set?
And maybe this: GL.EnableClientState(ArrayCap.TextureCoordArray);
The code is from C# but the names should be nearly the same.
Other than that, I don't really know whats wrong...
[QUOTE=nos217;38426552]This is frustrating, I thought I had a good handle on C++ and now I can't even implement a simple node/edge/graph structure.
Nevermind, I just realized that I should be excited about the opportunity to learn something new.[/QUOTE]
You really shouldn't let this bother you. C++ is MASSIVE, and it's only going to get bigger. Having a complete understanding of the numerous programming paradigms, code structuring and every tiny little piece of functionality(like initializer lists) is a near-impossible task. I've been programming in C++ for at least 7 years, and I still keep discovering, or rediscovering, new features to it every now and then.
The best way I've found to stay on top of subjects is first of all to subscribe to blogs and websites where they often discuss new features. Recently they set up a website dedicated to talks and news about C++ over at [url]www.isocpp.org[/url], which you should definitely check out every now and then. Secondly, whenever you come up with a solution to a problem in your code, but the solution just doesn't [I]feel right [/I]it's very likely that there's a better way, and looking around for that better way of doing it, is how you teach yourself about new aspects of the language.
[QUOTE=Felheart;38429329]Disable all features you don't absolutely need before drawing:
(GL_DEPTH_TEST, GL_CULL_FACE, GL_ALPHA_TEST)
Also what vertex colors did you set?
And maybe this: GL.EnableClientState(ArrayCap.TextureCoordArray);
The code is from C# but the names should be nearly the same.
Other than that, I don't really know whats wrong...[/QUOTE]
I've fixed my issue. Had to glPopAttrib() and glPushAttrib(). :v:
[QUOTE=Dr Magnusson;38434491]You really shouldn't let this bother you. C++ is MASSIVE, and it's only going to get bigger. Having a complete understanding of the numerous programming paradigms, code structuring and every tiny little piece of functionality(like initializer lists) is a near-impossible task. I've been programming in C++ for at least 7 years, and I still keep discovering, or rediscovering, new features to it every now and then.
The best way I've found to stay on top of subjects is first of all to subscribe to blogs and websites where they often discuss new features. Recently they set up a website dedicated to talks and news about C++ over at [url]www.isocpp.org[/url], which you should definitely check out every now and then. Secondly, whenever you come up with a solution to a problem in your code, but the solution just doesn't [I]feel right [/I]it's very likely that there's a better way, and looking around for that better way of doing it, is how you teach yourself about new aspects of the language.[/QUOTE]
I don't think it's so much about the language itself as the ideas. Much like spoken languages, every programming language is, for the most part, equally capable of implementing (explaining) ideas. Some have natural limitations that make something impossible, but sometimes you can figure out to hack in support (or use loanwords). Some are faster, or better managed, or easier to learn or use, but in the end, they all accomplish the same thing.
Programming is usually about the ideas, rather than the implementation. Something that's written in Java or whatever can be ported to C++ without massive hassle. Built-in functionality is very useful, but implementation specifics are just nuances in the face of the paradigms, patterns, and ideas involved.
Does C++ provide any asy way to remove punctuation characters from the beggining and end of a string?
at the moment I have [code]nextword.erase(remove(nextword.begin(),nextword.end(),'.'), nextword.end());[/code]
but I noticed that string has an ispunc method so I wondered if there is anyway to call erase ans pass an enum or something oter than a '.' that will remove any kind of punctuation.
[QUOTE=Richy19;38436688]Does C++ provide any asy way to remove punctuation characters from the beggining and end of a string?
at the moment I have [code]nextword.erase(remove(nextword.begin(),nextword.end(),'.'), nextword.end());[/code]
but I noticed that string has an ispunc method so I wondered if there is anyway to call erase ans pass an enum or something oter than a '.' that will remove any kind of punctuation.[/QUOTE]
I whipped up a function for you, cause I've been wanting one myself for a while:
[cpp]
static inline std::string trim(std::string str, std::function<bool(int)> filter)
{
str.erase(std::find_if(str.rbegin(), str.rend(), std::not1(filter)).base(), str.end());
str.erase(str.begin(), std::find_if(str.begin(), str.end(), std::not1(filter)));
return str;
}
[/cpp]
Example usage:
[cpp]
int main()
{
std::string str(".:?Hello world..");
std::string trimmed = trim(str, ispunct);
std::cout << "Untrimmed:\t\"" << str << "\"" << std::endl;
std::cout << "Trimmed:\t\"" << trimmed << "\"" << std::endl;
return 0;
}
[/cpp]
For the filter you just pass a function that takes an integer and returns a boolean. The function signals whether the character should be excluded (returns true), or included (returns false).
Yields:
[code]
Untrimmed: ".:?Hello world.."
Trimmed: "Hello world"
[/code]
Can someone guide me on linking GLFW with visual studio?
[QUOTE=Dr Magnusson;38439667]I whipped up a function for you, cause I've been wanting one myself for a while:
[cpp]
static inline std::string trim(std::string str, std::function<bool(int)> filter)
{
str.erase(std::find_if(str.rbegin(), str.rend(), std::not1(filter)).base(), str.end());
str.erase(str.begin(), std::find_if(str.begin(), str.end(), std::not1(filter)));
return str;
}
[/cpp]
Example usage:
[cpp]
int main()
{
std::string str(".:?Hello world..");
std::string trimmed = trim(str, ispunct);
std::cout << "Untrimmed:\t\"" << str << "\"" << std::endl;
std::cout << "Trimmed:\t\"" << trimmed << "\"" << std::endl;
return 0;
}
[/cpp]
For the filter you just pass a function that takes an integer and returns a boolean. The function signals whether the character should be excluded (returns true), or included (returns false).
Yields:
[code]
Untrimmed: ".:?Hello world.."
Trimmed: "Hello world"
[/code][/QUOTE]
Thanks :D
Could I get some information on what:
std::function<bool(int)> filter
std::not1(filter)).base()
do?
as its for an assignment I need to know myself encase I get asked
std::function<bool(int)> can be any function-like thing that takes one int and returns a bool.
Normally one would use a function pointer, but since it's C++, lambda functions and function objects (despite looking like functions, and behaving like functions) aren't functions, you couldn't pass them as a function pointer. That construct accepts them.
std::not1() is just a logical negation of its input function or function object.
[QUOTE=ThePuska;38447319]std::function<bool(int)> can be any function-like thing that takes one int and returns a bool.
Normally one would use a function pointer, but since it's C++, lambda functions and function objects (despite looking like functions, and behaving like functions) aren't functions, you couldn't pass them as a function pointer. That construct accepts them.
std::not1() is just a logical negation of its input function or function object.[/QUOTE]
Just to check is the std::function thing a c++11 exclusive?
if o is there any way to do it without the use of C++11 stuff?
[editline]14th November 2012[/editline]
Also I dont mind if its not in a function of its own, I only use it once so it can bbe inlined
[editline]14th November 2012[/editline]
Not to worry, I just ended up doing:
[cpp]
while(ispunct(nextword[0]) && (nextword.length > 0))
{
nextword.erase(0,1);
}
while(ispunct(nextword[nextword.length-1]) && (nextword.length > 0))
{
nextword.erase(nextword.length-1,1);
}[/cpp]
I'd like some help if you've got a minute and a C compiler
Compile and run the following program, and post its output and what compiler and what version you used. I'd especially like to know what Clang outputs
If the compiler doesn't support __attribute__((aligned)), just comment those lines out, and remove the printf("GNU align:") part as well.
If the output is
[code]_ALIGNED(): 0 0
GNU align: 0 0
Unaligned: 0 0[/code]
please run it a few more times to make sure it won't output anything but zeroes (i.e. it's not aligned just by chance)
[cpp]#include <stddef.h>
#include <stdio.h>
/* Ugly hacks to allow alignment on the stack for compilers which
* fail to support it natively.
* _ALIGNED() works by allocating more memory than necessary, then
* creating a pointer to the smallest allocated address that is
* aligned.
* Call: _ALIGNED(float, 4, 16, t) to allocate a float t[4] array,
* aligned to 16 bytes. Reserves the names "_t" and "t". */
#define _ALIGN_PTR(p, n) ((char *)(p) + ((n) - ((size_t)(p) % (n)) % (n)))
#define _ALIGNED(dtype, minsize, align, varname) \
dtype _##varname [minsize + align]; \
dtype *varname = (dtype *)_ALIGN_PTR(_##varname, align); \
int main(int argc, char *argv[])
{
_ALIGNED(float, 2, 16, a0)
_ALIGNED(float, 2, 16, a1)
float g0 [2] __attribute__ ((aligned(16))); /* Remove these two lines */
float g1 [2] __attribute__ ((aligned(16))); /* if they're generating errors. */
float u0 [2];
float u1 [2];
printf("_ALIGNED(): %x %x\n", (size_t)a0 % 16, (size_t)a1 % 16);
printf("GNU align: %x %x\n", (size_t)g0 % 16, (size_t)g1 % 16); /* Remove this if you removed g0 & g1 */
printf("Unaligned %x %x\n", (size_t)u0 % 16, (size_t)u1 % 16);
return 0;
}[/cpp]
I get zeros all the time with GCC, but on Clang I get this:
[code]_ALIGNED(): 0 0
GNU align: 0 0
Unaligned 8 0[/code]
Clang on OS X (64 bit):
[code]
_ALIGNED(): 0 0
GNU align: 0 0
Unaligned 8 0
[/code]
GCC on OS X (64 bit):
[code]
_ALIGNED(): 0 0
GNU align: 0 0
Unaligned 8 0
[/code]
Clang on Linux (64 bit):
[code]
_ALIGNED(): 0 0
GNU align: 0 0
Unaligned 0 8
[/code]
GCC on Linux (64 bit):
[code]
_ALIGNED(): 0 0
GNU align: 0 0
Unaligned 0 0
[/code]
GCC on Linux (32 bit):
[code]
_ALIGNED(): 0 0
GNU align: 0 0
Unaligned 8 0
[/code]
How do I go about using JNI to use Open Steamworks in Java? I have no idea what I'm doing here
Trying to figure out something for a programming assignment. (C++)
The task is to print an array of data, which I accomplished already, and then put the data in ascending order and display that.
The pseudocode given for the sorting loop is:
For I = 0 to (number of array elements - 2), increment by 1
For J = (I + 1) to (number of array elements - 1), increment by 1
If X[I] is greater than X[J] then
swap X[I] and X[J]
Next J
Next I
What I have as far as actual code goes is:
[cpp]#include <iostream>
using namespace std;
int main ()
{
int x[] = { 28, 87, -3, 45, 19 };
int I = 0;
int J = 1;
int i = 0;
cout << "The unsorted array is: " << endl;
for (i = 0; i <= (sizeof(x)/4) - 1; i++) //This prints the array before being sorted
{
cout << x[i] << endl;
}
cout << "Once sorted, the array is: " << endl;
for (I = 0; (sizeof(x)/4)-3; I++) //This sorts the array
{
for (J = (I + 1); (sizeof(x)/4)-2; J++)
{
if (x[I] > x[J])
{
system("pause");
return 0;
}
[/cpp]
I've tried several things to actually get it to "swap" but I've been wracking my brains for hours and haven't gotten anywhere.
Any suggestions would be lovely.
[editline]16th November 2012[/editline]
Oh and one more thing: pointers aren't allowed.
Sorry, you need to Log In to post a reply to this thread.