• What do you need help with? Version 5
    5,752 replies, posted
[QUOTE=ief014;38682889]For pointers you must use the "->" operator instead of the "." operator.[/QUOTE] sweet thanks that got rid of all my errors in the compiler but the program wont display any output [IMG]http://i.imgur.com/nscoe.png[/IMG] code: [cpp] //* This program displays a grade report based upon data read from //* a text file and saved in a simple unordered linked list. Some file error //* checking is included. //************************* #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; struct tStudent { //node data string studentFName; string studentLName; int testScore; char grade; //node link tStudent* link; }; void appendNode(tStudent*&, tStudent); //add one node to end of linked list //PREC: P1-starting address of list (NULL if empty list) // P2-student record to added //PSTC: student record added to end of list; P1 valid list start address void calculateGrade(tStudent*); //traverse unordered linked list and assign letter grade to each node based upon testScore //PREC: P1-valid list starting address //PSTC: student record nodes populated with letter grade tStudent* findLastNode(tStudent*); //traverse unordered linked list and return address of last node //PREC: P1-valid list starting address //PSTC: valid address of last node bool getData(tStudent*&, int&); //reads text file and builds unordered linked list of student records //PREC: P1-starting address of list (NULL if empty list) // P2-address of record count variable //PSTC: P1-valid list starting address // P2-record count of text file records // returns true is successfull file access void printResult(tStudent*); //traverse unordered linked list and print formatted report //PREC: P1-valid list starting address //PSTC: student formatted report completed int main() { int numStudents; //count of student records in text file tStudent* pStudents = NULL; //head of linked list of student nodes bool flag; //true indicates no file errors flag = getData(pStudents, numStudents); if (flag) { cout << "...Number of Student Records = " << numStudents << endl; calculateGrade(pStudents); printResult(pStudents); } else cout << "...RUN TERMINATED\n"; system("pause"); return 0; } bool getData(tStudent*& pHead, int& listSize) { ifstream fStudents; tStudent studentRec; bool fileFound; int i; fStudents.open("StudentGrades.txt"); if(!fStudents) { fileFound = false; cout << "\n*****FILE NOT FOUND*****\n"; } else { fileFound = true; i = 0; fStudents >> studentRec.studentFName //initialize fStudents >> studentRec.studentLName //...and load data >> studentRec.testScore; while(fStudents) //test fStudents for EOF { i++; appendNode(pHead, studentRec); //add student node to end of list fStudents >> studentRec.studentFName //modify fStudents >> studentRec.studentLName //...and load data >> studentRec.testScore; } listSize = i; fStudents.close(); } return fileFound; } void appendNode(tStudent*& pHead, tStudent student) { tStudent* pLastNode; tStudent* pNewNode; if(pHead != NULL) { // ***processing for all other nodes pLastNode = findLastNode(pHead); // other statements to get a node from the heap // and populate the data fields and link field; // add node to the list pNewNode->studentFName; pNewNode->studentLName; pNewNode->testScore; pNewNode->grade; pNewNode->link = NULL; } else { // ***processing for first node of list // statements to get a node from the heap // and populate data fields and link field; // this is first node in list pNewNode = new tStudent; pNewNode->studentFName; pNewNode->studentLName; pNewNode->testScore; pNewNode->grade; pNewNode->link = NULL; } } tStudent* findLastNode(tStudent* pHead) { tStudent* pCurrent = pHead; tStudent* pLastNode = NULL; //traverse list and find address of last node while( pCurrent != NULL){ pCurrent = pCurrent->link; pCurrent = pLastNode; } return pLastNode; } void calculateGrade(tStudent* pHead) { tStudent* pCurrent = pHead; // traverse list and process each node to determine letter grade assigned while( pCurrent != NULL){ if( pCurrent->testScore <= 100 && pCurrent->testScore >= 90) pCurrent->grade = 'A'; else if( pCurrent->testScore < 90 && pCurrent->testScore >= 80) pCurrent->grade = 'B'; else if( pCurrent->testScore < 80 && pCurrent->testScore >= 70) pCurrent->grade = 'C'; else if( pCurrent->testScore < 70 && pCurrent->testScore >= 60) pCurrent->grade = 'D'; else if( pCurrent->testScore < 60 && pCurrent->testScore >= 0) pCurrent->grade = 'F'; else pCurrent->grade = '*'; pCurrent = pCurrent->link; } } void printResult(tStudent* pHead) //traverses L-list and prints data component { tStudent* pCurrent = pHead; //Heading Line cout << endl; cout << left << setw(25) << "Student Name" << right << setw(10) << "Test Score" << setw(7) << "Grade" << endl << endl; // Detail Lines - traverse list and print each node while(pCurrent !=NULL){ cout << pCurrent->studentFName << ", " << pCurrent->studentLName << " " << pCurrent->testScore << " " << pCurrent->grade << endl; pCurrent = pCurrent->link; } cout << endl; } [/cpp]
Does anyone know how to expose C++ objects to Lua using just the standard Lua 5.2 library? If so, could you please try to enlighten me.
Okay, back again with another request. I have a text file, "input2.txt". It looks like this: [code] 10 20 30 40 50 50 40 30 20 10 [/code] I have two arrays, I've declared them as "arrA" and "arrB". I need "arrA" to read the first line of values in this text file. I haven't had any luck using statements such as && != '\n' in the "while" loop. I thought that would solve my issue. However, it just scrambles up the numbers it seems. I need the program to: 1) Print arrA (which I have done successfully) 2) Print arrB (which I hope to accomplish) 3) Tell the user whether they are in perfect order (10::10, 20::20), reversed order (10::50)(20::40), or out of order. Here is what I have so far. [code]#include <stdio.h> #define MAX_SIZE 100 int main (void) { FILE* spInput = fopen("input2.txt","r"); int in = 0; int arrA[MAX_SIZE]; int arrB[MAX_SIZE]; int count = 0; while(fscanf(spInput, "%d", &in) != EOF) { arrA[count] = in; count++; } int index; printf("Original set:\n"); for(index = 0; index < count; index++) printf("%d\t",arrA[index]); return 0; } [/code]
I already asked this to the web development sub forum but I didn't get a response and that was about 4 days ago so I'm going to give it a try over here. I need some help with an SQL query. I'm using Sybase 12.5 and I want to make it so that it does the following: if @Par09 = 'A' do not discriminate if @Par09 = 'S' then P.QualityCode = 'S' if @Par09 = 'C' then P.QualityCode can be any of these '','A','C','D','O','R' The unique data that P.QualityCode holds is the following: [code]+-------------+-------+ | QualityCode | Count | +-------------+-------+ | | 143 | | A | 3551 | | C | 1409 | | D | 1698 | | O | 24563 | | R | 59 | | S | 22040 | +-------------+-------+[/code] This is small version of the Stored Procedure I'm writing (the actual one is 150 lines long so I'm not gonna post that): [code]Create Proc MPX_sel_BOMStatus ( /* A lot of variables */ @Par09 varchar(1) = 'A' ) with recompile As Begin Select P.QualityCode From T_Part P Where P.QualityCode = Case when @Par09 = 'S' then 'S' else Case when @Par09 = 'A' then in('','A','C','D','O','R') else in('','A','C','D','O','R','S') end end end[/code] But when I get this when I try to update the Stored Procedure: [code]------------------------ Execute ------------------------ Changed database context to 'TestProduktieDB'. Incorrect syntax near the keyword 'in'. dbo.MPX_sel_BOMStatus not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output). dbo.MPX_sel_BOMStatus not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output). ----------------- Done ( 3 errors ) ------------------ [/code] Does anyone know what I'm doing wrong?
Figured it out (finally): [code] Select P.QualityCode From T_Part P Where (P.QualityCode in ('','A','C','D','O','R') and @Par09 = 'C') or (P.QualityCode in ('','A','C','D','O','R','S') and @Par09 = 'A') or (P.QualityCode = 'S' and @Par09 = 'S') [/code] [editline]3rd December 2012[/editline] Automerge ;_;
My brain is fried right now. What's the best way to do this in Ruby? I want to group an array like this: [code]Array[["M", "10:00"], ["M", "11:00"], ["T", "9:00"], ["T", "11:00"], ["T", "12:00"], ["W", "2:00"]][/code] into this: [code]Array[["M",["10:00","11:00"]],["T",["9:00","11:00","12:00"]],["W",["2:00"]]][/code]
Here's something I whipped up [code] output = [] input.each{ |a| bool = false output.each{ |b| if b[0] == a[0] then b[1][b[1].length] = a[1] bool = true end } if !bool then output[output.length] = [a[0],[a[1]]] end } [/code]
[QUOTE=meppers;38683007]sweet thanks that got rid of all my errors in the compiler but the program wont display any output [IMG]http://i.imgur.com/nscoe.png[/IMG] code: [cpp] //* This program displays a grade report based upon data read from //* a text file and saved in a simple unordered linked list. Some file error //* checking is included. //************************* #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; struct tStudent { //node data string studentFName; string studentLName; int testScore; char grade; //node link tStudent* link; }; void appendNode(tStudent*&, tStudent); //add one node to end of linked list //PREC: P1-starting address of list (NULL if empty list) // P2-student record to added //PSTC: student record added to end of list; P1 valid list start address void calculateGrade(tStudent*); //traverse unordered linked list and assign letter grade to each node based upon testScore //PREC: P1-valid list starting address //PSTC: student record nodes populated with letter grade tStudent* findLastNode(tStudent*); //traverse unordered linked list and return address of last node //PREC: P1-valid list starting address //PSTC: valid address of last node bool getData(tStudent*&, int&); //reads text file and builds unordered linked list of student records //PREC: P1-starting address of list (NULL if empty list) // P2-address of record count variable //PSTC: P1-valid list starting address // P2-record count of text file records // returns true is successfull file access void printResult(tStudent*); //traverse unordered linked list and print formatted report //PREC: P1-valid list starting address //PSTC: student formatted report completed int main() { int numStudents; //count of student records in text file tStudent* pStudents = NULL; //head of linked list of student nodes bool flag; //true indicates no file errors flag = getData(pStudents, numStudents); if (flag) { cout << "...Number of Student Records = " << numStudents << endl; calculateGrade(pStudents); printResult(pStudents); } else cout << "...RUN TERMINATED\n"; system("pause"); return 0; } bool getData(tStudent*& pHead, int& listSize) { ifstream fStudents; tStudent studentRec; bool fileFound; int i; fStudents.open("StudentGrades.txt"); if(!fStudents) { fileFound = false; cout << "\n*****FILE NOT FOUND*****\n"; } else { fileFound = true; i = 0; fStudents >> studentRec.studentFName //initialize fStudents >> studentRec.studentLName //...and load data >> studentRec.testScore; while(fStudents) //test fStudents for EOF { i++; appendNode(pHead, studentRec); //add student node to end of list fStudents >> studentRec.studentFName //modify fStudents >> studentRec.studentLName //...and load data >> studentRec.testScore; } listSize = i; fStudents.close(); } return fileFound; } void appendNode(tStudent*& pHead, tStudent student) { tStudent* pLastNode; tStudent* pNewNode; if(pHead != NULL) { // ***processing for all other nodes pLastNode = findLastNode(pHead); // other statements to get a node from the heap // and populate the data fields and link field; // add node to the list pNewNode->studentFName; pNewNode->studentLName; pNewNode->testScore; pNewNode->grade; pNewNode->link = NULL; } else { // ***processing for first node of list // statements to get a node from the heap // and populate data fields and link field; // this is first node in list pNewNode = new tStudent; pNewNode->studentFName; pNewNode->studentLName; pNewNode->testScore; pNewNode->grade; pNewNode->link = NULL; } } tStudent* findLastNode(tStudent* pHead) { tStudent* pCurrent = pHead; tStudent* pLastNode = NULL; //traverse list and find address of last node while( pCurrent != NULL){ pCurrent = pCurrent->link; pCurrent = pLastNode; } return pLastNode; } void calculateGrade(tStudent* pHead) { tStudent* pCurrent = pHead; // traverse list and process each node to determine letter grade assigned while( pCurrent != NULL){ if( pCurrent->testScore <= 100 && pCurrent->testScore >= 90) pCurrent->grade = 'A'; else if( pCurrent->testScore < 90 && pCurrent->testScore >= 80) pCurrent->grade = 'B'; else if( pCurrent->testScore < 80 && pCurrent->testScore >= 70) pCurrent->grade = 'C'; else if( pCurrent->testScore < 70 && pCurrent->testScore >= 60) pCurrent->grade = 'D'; else if( pCurrent->testScore < 60 && pCurrent->testScore >= 0) pCurrent->grade = 'F'; else pCurrent->grade = '*'; pCurrent = pCurrent->link; } } void printResult(tStudent* pHead) //traverses L-list and prints data component { tStudent* pCurrent = pHead; //Heading Line cout << endl; cout << left << setw(25) << "Student Name" << right << setw(10) << "Test Score" << setw(7) << "Grade" << endl << endl; // Detail Lines - traverse list and print each node while(pCurrent !=NULL){ cout << pCurrent->studentFName << ", " << pCurrent->studentLName << " " << pCurrent->testScore << " " << pCurrent->grade << endl; pCurrent = pCurrent->link; } cout << endl; } [/cpp][/QUOTE] help..............
learn how to use your debugger
Nevermind, I did it.
I'm having trouble making a copy (not a reference) of a matrix in Java. I know that you can use the clone() method to copy an Array, but it does not seem to work and the arrays still refer to the same object. Here is the current code I have. I want puzzle, solvedPuzzle, originalPuzzle to be completely different objects. [IMG]http://i.imgur.com/ZIKi5.png[/IMG]
Deep cloning in Java has always been more or less of a problem. Just use collections.
[QUOTE=Meatpuppet;38668046]Sorry for the inconvenience, but if anyone would be willing to download [URL="http://www.4shared.com/get/aGdTGsU6/OpenGL.html;jsessionid=74E93E6FB162D31B210926283F6A442B.dc322"]t[/URL]his file and tell me what comes up, that would be great... I've debugged my program to shit, did what everyone told me to, and it's still just displaying a white background. [URL]http://www.mediafire.com/?7gca7qc24n8oibg[/URL][/QUOTE] Anyone? I really need help on this, I can't continue until this is fixed...
[QUOTE=Mozartkugeln;38693006]Deep cloning in Java has always been more or less of a problem. Just use collections.[/QUOTE] Yeah, but there has to be a way. Is there some sort of loop I can traverse to clone everything over? Is there another method better for this?
i just started learning c++ yesterday, so I have no idea what I'm doing main.h [code] #ifndef MAIN_H #define MAIN_H #include <iostream> #include <string> std::string direction; std::string getDirection(std::string a); #endif [/code] main.cpp [code]#include "main.h" #include "locations.h" #include "player.h" std::string getDirection(std::string a) { if ((a == "n") || (a == "N") || (a =="north") || (a == "NORTH") || (a=="North")) { return ("north"); } else if ((a == "s") || (a == "S") || (a =="south") || (a == "SOUTH") || (a=="South")) { return ("south"); } } int adventure() { start_area(); } int main() { std::cout<<"Welcome to GAME\n"; std::cout<<"Enter your name scrub\n"; std::cin>>player_name; std::cout<<"Are you right or left handed?\n"; std::cin>>player_hand; adventure(); } [/code] player.h [code]#ifndef PLAYER_H #define PLAYER_H #include <iostream> #include <string> std::string player_name; std::string player_hand; #endif [/code] player.cpp [code]#include "player.h" bool player_handed(std::string player_hand) { if ((player_hand == "right") || (player_hand == "Right")) { return true; } else { return false; } } int player_equipment() { int player_right_hand; int player_left_hand; int player_head; int player_chest; int player_legs; int player_feet; } int player_accuracy() { int right_hand_accuracy; int left_hand_accuracy; if ((player_handed(player_hand)) == true) { right_hand_accuracy += 10; } else { left_hand_accuracy += 10; } } [/code] getting these errors [code] C:\c++\game\locations.cpp||In function 'int start_area()':| C:\c++\game\locations.cpp|23|warning: no return statement in function returning non-void| C:\c++\game\locations.cpp||In function 'int mountains()':| C:\c++\game\locations.cpp|28|warning: no return statement in function returning non-void| C:\c++\game\locations.cpp||In function 'int desert()':| C:\c++\game\locations.cpp|33|warning: no return statement in function returning non-void| C:\c++\game\main.cpp||In function 'int adventure()':| C:\c++\game\main.cpp|23|warning: no return statement in function returning non-void| C:\c++\game\main.cpp||In function 'std::string getDirection(std::string)':| C:\c++\game\main.cpp|16|warning: control reaches end of non-void function| C:\c++\game\combat.cpp||In function 'int combat()':| C:\c++\game\combat.cpp|12|warning: no return statement in function returning non-void| C:\c++\game\combat.cpp||In function 'int attacks()':| C:\c++\game\combat.cpp|21|warning: no return statement in function returning non-void| obj\Debug\main.o||In function `Z12getDirectionSs':| C:\c++\game\main.cpp|7|multiple definition of `direction'| obj\Debug\locations.o:C:\c++\game\locations.cpp|5|first defined here| obj\Debug\player.o||In function `Z13player_handedSs':| C:\c++\game\player.cpp|4|multiple definition of `player_name'| obj\Debug\main.o:C:\c++\game\main.cpp|7|first defined here| obj\Debug\player.o||In function `Z13player_handedSs':| C:\c++\game\player.cpp|4|multiple definition of `player_hand'| obj\Debug\main.o:c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\basic_string.h|2270|first defined here| obj\Debug\combat.o||In function `Z6combatv':| C:\c++\game\combat.cpp|8|multiple definition of `weapon_damage'| obj\Debug\weapons.o:c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\iostream|72|first defined here| ||=== Build finished: 8 errors, 7 warnings ===| [/code] it's probably a really dumb mistake, would appreciate any help i have more code, but i think the mistake I'm making can be figured out from the code above
[QUOTE=Yumyumbublegum;38694619]i just started learning c++ yesterday, so I have no idea what I'm doing -code snip- it's probably a really dumb mistake, would appreciate any help i have more code, but i think the mistake I'm making can be figured out from the code above[/QUOTE] Your functions need to return the type that you declared the function as. So your function player_accuracy() would need to have a "return <int>;" at the end of it. If you don't need the function to return an int or bool use a void type function. Also, may I suggest doing some reading on how to structure a program.
[QUOTE=Pangogie;38694835]You functions need to return the type that you declared the function as. So your function player_accuracy() would need to have a "return <int>;" at the end of it. If you don't need the function to return an int or bool use a void type function.[/QUOTE] Yea, but the issue at hand is with this: [code] obj\Debug\main.o||In function `Z12getDirectionSs':| C:\c++\game\main.cpp|7|multiple definition of `direction'| obj\Debug\locations.o:C:\c++\game\locations.cpp|5|first defined here| obj\Debug\player.o||In function `Z13player_handedSs':| C:\c++\game\player.cpp|4|multiple definition of `player_name'| obj\Debug\main.o:C:\c++\game\main.cpp|7|first defined here| obj\Debug\player.o||In function `Z13player_handedSs':| C:\c++\game\player.cpp|4|multiple definition of `player_hand'| obj\Debug\main.o:c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\basic_string.h|2270|first defined here| obj\Debug\combat.o||In function `Z6combatv':| C:\c++\game\combat.cpp|8|multiple definition of `weapon_damage'| obj\Debug\weapons.o:c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\iostream|72|first defined here| [/code] sorry, should have cut out the other stuff
you cannot define a variable more than once
[QUOTE=Meatpuppet;38695596]you cannot define a variable more than once[/QUOTE] I've looked all over, it seems that it's only defined once.
[cpp]C:\c++\game\main.cpp|7|multiple definition of `direction'| obj\Debug\locations.o:C:\c++\game\locations.cpp|5|first defined here|[/cpp] this tells you where the variable was first defined the first line is the repeat define the second is first define
I'm having problems looping or storing in a vector. It only returns the one tile and I believe these are the lines of code that are causing the problems. [code]sf::Sprite DrawStack() { for (std::list<Entity>::iterator EIT = Stack.begin(); EIT != Stack.end(); ++EIT) { return (*EIT).GetSprite(); } } void GenerateMap(int x, int y) { Mapx = x; Mapy = y; for (int xc = 0;xc !=Mapx; xc++) { for (int yc = 0;yc !=Mapy; yc++) { Entity tile("C:/Users/SYSTEMIDL/Documents/Programming/S111112/materials/G01a.png", (128.0 * xc), (64.0 * yc)); Stack.push_back(tile); } } } [/code]
[QUOTE=ShaunOfTheLive;38688533]My brain is fried right now. What's the best way to do this in Ruby? I want to group an array like this: [code]Array[["M", "10:00"], ["M", "11:00"], ["T", "9:00"], ["T", "11:00"], ["T", "12:00"], ["W", "2:00"]][/code] into this: [code]Array[["M",["10:00","11:00"]],["T",["9:00","11:00","12:00"]],["W",["2:00"]]][/code][/QUOTE] You can do it like this: [code] output = Hash.new { |h, k| k[k] = [] } input.each do |a, b| output[a] << b end [/code]
I had a go at making a functional version in Haskell. [code]tupleList v = foldr (prependList) [] v where prependList (lk, lv) r | r == [] = [(lk, [lv])] | lk /= rk = (lk, [lv]):r | otherwise = (rk, lv:rv):rr where (rk, rv):rr = r[/code]
[QUOTE=ThePuska;38698494]I had a go at making a functional version in Haskell. [code]tupleList v = foldr (prependList) [] v where prependList (lk, lv) r | r == [] = [(lk, [lv])] | lk /= rk = (lk, [lv]):r | otherwise = (rk, lv:rv):rr where (rk, rv):rr = r[/code][/QUOTE] This won't handle thingies that aren't consecutive
I don't think it should.
Yeah, it's pre-sorted anyway. But thanks for all the variations!
[QUOTE=W00tbeer1;38691973]I'm having trouble making a copy (not a reference) of a matrix in Java. I know that you can use the clone() method to copy an Array, but it does not seem to work and the arrays still refer to the same object. Here is the current code I have. I want puzzle, solvedPuzzle, originalPuzzle to be completely different objects. [IMG]http://i.imgur.com/ZIKi5.png[/IMG][/QUOTE] Just incase anybody was wondering, I just simply traversed the array through a loop. Might not be the most efficient way, but it does the job: [img]http://i.imgur.com/2t30i.png[/img]
What would be the best way to make a "particle" game? The only way I can think of is to make every particle an entity and then run collision for every pixel, but I don't think that'll be efficient. If you don't know what I'm talking about, an example pic: [img]http://www.best1000games.com/wp-content/uploads/2012/10/powder-game-1.jpg[/img]
[QUOTE=Staneh;38700826]What would be the best way to make a "particle" game? The only way I can think of is to make every particle an entity and then run collision for every pixel, but I don't think that'll be efficient. If you don't know what I'm talking about, an example pic: [IMG]http://www.best1000games.com/wp-content/uploads/2012/10/powder-game-1.jpg[/IMG][/QUOTE] Save only the position + particle type. Then iterate over it and apply the specific physics. You can use multithreading (different particles on different threads), to process the whole simulation faster. Also for collision you HAVE to use a grid-type. Everything else will be too slow for so many particles ( that includes quadtrees). If you want to go really badass: write the complete program as a shader or use direct-computing on the gpu. If you want the particles to have velocity you might want to use a force-field type approach for that. That means you have a x and y velocity at every grid-pixel and use that instead. Think about it, multiple particles can be in one pixel/grid-cell, but they share the velocity. Then when you have to move them, get the velocity and multiply it by a constant factor for that particle (stone gets its velocity multiplied by 0, and water by 0.8, ...). Also if you're writing in C/++ or C# you can (and SHOULD) use the multimedia extensions of your CPU (MMX). If all fails, take a look at the powder toy sourcecode :P
[QUOTE=chaoselite;38696472]I'm having problems looping or storing in a vector. It only returns the one tile and I believe these are the lines of code that are causing the problems. [code]sf::Sprite DrawStack() { for (std::list<Entity>::iterator EIT = Stack.begin(); EIT != Stack.end(); ++EIT) { return (*EIT).GetSprite(); } } void GenerateMap(int x, int y) { Mapx = x; Mapy = y; for (int xc = 0;xc !=Mapx; xc++) { for (int yc = 0;yc !=Mapy; yc++) { Entity tile("C:/Users/SYSTEMIDL/Documents/Programming/S111112/materials/G01a.png", (128.0 * xc), (64.0 * yc)); Stack.push_back(tile); } } } [/code][/QUOTE] You probably meant [I]vector[/I] iterator [cpp]sf::Sprite DrawStack() { for (std::vector<Entity>::iterator it = Stack.begin(); it != Stack.end(); ++it) { return (*it).GetSprite(); // or it->GetSprite() } } [/cpp]
Sorry, you need to Log In to post a reply to this thread.