• What do you need help with? Version 5
    5,752 replies, posted
Could someone explain how Java's inheritance, superclasses, subclasses, and the like work? Not like the usual "Think of it like the bicycle. This is a tire..." crap, but somewhat more being able to whip it out in code. I can't seem to grasp it right now.
I have an Icosphere and im trying to add height values to it via simplex noise. So I get the noise value for each vertice of each triangle, but how do I convert that into a Vector3 to then add to the current vertice value?
more homework help time first heres my code, were learning about storing and reading information with structs [cpp] //* This program collects school related information from the user and displays the info //* in a properly formatted manner //************************* //**Preprocessor Directives #include <iostream> #include <string> using namespace std; enum classification {FRESHMAN, SOPHOMORE}; enum program {AA, AAS, CC, OTHER}; struct StudentName //Questionnaire student name { string nameLast; string nameFirst; }; struct HomeInfo //Questionnaire section 1.4-1.6 { StudentName name; string telephone; string email; char empStatus; }; struct SchoolInfo //Questionnaire section 1.1-1.3 { string stuClass; string degree; int hrsEnroll; }; struct ComputerInfo //Questionnaire section 3 { bool homeComputer; string hardware; string opSystem; string computerUse; }; struct SkillInfo //Questionnaire section 5 { short ratings[13]; string product[4]; }; struct Quest01 //Course Questionnaire { HomeInfo infoHome; SchoolInfo infoSchool; ComputerInfo infoComputer; SkillInfo infoSkill; }; void getForm(Quest01&); void getHomeInfo(Quest01&); void getSchoolInfo(Quest01&); void getComputerInfo(); //STUB void getSkillInfo(); //STUB int main() { //*****Local Variables and Constants Quest01 studentQuest; //*****Program Statements cout << "COSC 1437 Lab U1-07h " << "<your name >" << endl << endl; getForm(studentQuest); // display selected items cout << "Questionnaire for " << studentQuest.infoHome.name.nameFirst << " " << studentQuest.infoHome.name.nameLast << endl; cout << "Telephone: " << studentQuest.infoHome.telephone << endl; cout << "Employment Status: " << studentQuest.infoHome.empStatus << endl; cout << "Program: " << studentQuest.infoSchool.degree << endl; system("pause"); return 0; } void getForm(Quest01&) { Quest01 studentQuest; getHomeInfo(studentQuest ); getSchoolInfo(studentQuest ); getComputerInfo (); //stub getSkillInfo(); //stub } void getHomeInfo(Quest01& ) { Quest01 studentQuest; cout << "Enter your first name: "; cin >> studentQuest.infoHome.name.nameFirst; cout << "Enter your last name: "; cin >> studentQuest.infoHome.name.nameLast; cout << "What is yourhome telephone number? "; cin >> studentQuest.infoHome.telephone; cout << "What is your email adress? "; cin >> studentQuest.infoHome.email; cout << "Employment status? (N = Not employed)" << endl; cout << " (F = Full Time)" << endl; cout << " (P = Part Time): "; cin >> studentQuest.infoHome.empStatus; } void getSchoolInfo(Quest01& ) { Quest01 studentQuest; cout << "How are you classified? (F = Freshman; S = Sophomore): "; cin >> studentQuest.infoSchool.stuClass; cout << "In which program of study are you enrolled?" <<endl; cout << " (AA = Associate of Arts)" << endl; cout << " (AAS = Associate in Applied Science)" << endl; cout << " (CC = Certificate of Completion)" << endl; cout << " (OTHER = Other): "; cin >> studentQuest.infoSchool.degree; cout << "In how many hours are you enrolled this semester? "; cin >> studentQuest.infoSchool.hrsEnroll; } void getComputerInfo() { cout << "...getComputerInfo()..." << endl; //stub } void getSkillInfo () { cout << "...getSkillInfo()..." << endl; //stub } [/cpp] now for some reason the information i store never "sticks" into my structs, i can display the stored information by doing a "cout" statement inside the same function that i gathered that data, but when my program moves onto another function down the line of code, all information that i put into my stucts seems to dissapear [editline]7th October 2012[/editline] Oh yeah ignore the shit labeled stub, that's for a separate assignment
The concepts you need to learn are "function scope" or "scope" in general; global variables and local variables. [editline]8th October 2012[/editline] To elaborate, the error raises from the fact that you [i]declare[/i] a Quest01 inside every function that does things on it. You need to declare it globally in order to allow multiple functions to access the same copy of Quest01.
ok puska you make sense. so i got rid of that dumb "studentQuest" thing i put into each function, and i am now at this: [cpp] //* This program collects school related information from the user and displays the info //* in a properly formatted manner //************************* //**Preprocessor Directives #include <iostream> #include <string> using namespace std; enum classification {FRESHMAN, SOPHOMORE}; enum program {AA, AAS, CC, OTHER}; struct StudentName //Questionnaire student name { string nameLast; string nameFirst; }; struct HomeInfo //Questionnaire section 1.4-1.6 { StudentName name; string telephone; string email; char empStatus; }; struct SchoolInfo //Questionnaire section 1.1-1.3 { string stuClass; string degree; int hrsEnroll; }; struct ComputerInfo //Questionnaire section 3 { bool homeComputer; string hardware; string opSystem; string computerUse; }; struct SkillInfo //Questionnaire section 5 { short ratings[13]; string product[4]; }; struct Quest01 //Course Questionnaire { HomeInfo infoHome; SchoolInfo infoSchool; ComputerInfo infoComputer; SkillInfo infoSkill; }; void getForm(Quest01&); void getHomeInfo(Quest01&); void getSchoolInfo(Quest01&); void getComputerInfo(); //STUB void getSkillInfo(); //STUB int main() { //*****Local Variables and Constants Quest01 studentQuest; //*****Program Statements cout << "COSC 1437 Lab U1-07h " << "<Elliott Warren>" << endl << endl; getForm(studentQuest); // display selected items cout << "Questionnaire for " << studentQuest.infoHome.name.nameFirst << " " << studentQuest.infoHome.name.nameLast << endl; cout << "Telephone: " << studentQuest.infoHome.telephone << endl; cout << "Employment Status: " << studentQuest.infoHome.empStatus << endl; cout << "Program: " << studentQuest.infoSchool.degree << endl; system("pause"); return 0; } void getForm(Quest01&) { Quest01 studentQuest; getHomeInfo(studentQuest ); getSchoolInfo(studentQuest ); getComputerInfo (); //stub getSkillInfo(); //stub } void getHomeInfo(Quest01& ) { cout << "Enter your first name: "; cin >> Quest01.infoHome.name.nameFirst; cout << "Enter your last name: "; cin >> Quest01.infoHome.name.nameLast; cout << "What is yourhome telephone number? "; cin >> Quest01.infoHome.telephone; cout << "What is your email adress? "; cin >> Quest01.infoHome.email; cout << "Employment status? (N = Not employed)" << endl; cout << " (F = Full Time)" << endl; cout << " (P = Part Time): "; cin >> Quest01.infoHome.empStatus; } void getSchoolInfo(Quest01& ) { cout << "How are you classified? (F = Freshman; S = Sophomore): "; cin >> Quest01.infoSchool.stuClass; cout << "In which program of study are you enrolled?" <<endl; cout << " (AA = Associate of Arts)" << endl; cout << " (AAS = Associate in Applied Science)" << endl; cout << " (CC = Certificate of Completion)" << endl; cout << " (OTHER = Other): "; cin >> Quest01.infoSchool.degree; cout << "In how many hours are you enrolled this semester? "; cin >> Quest01.infoSchool.hrsEnroll; } void getComputerInfo() { cout << "...getComputerInfo()..." << endl; //stub } void getSkillInfo () { cout << "...getSkillInfo()..." << endl; //stub } [/cpp] and now i get errors on every line that i try to put something into a struct for example: i get the error "left of '.infoHome' must have class/struct/union" on line 89 [cpp] cin >> studentQuest.infoHome.name.nameFirst;[/cpp][FONT=Tahoma, Calibri, Verdana, Geneva, sans-serif][/FONT] [editline]7th October 2012[/editline] (editing posts with cpp tags in them is a pain in the ass so just ignore that weird font thing at the end ^)
Like this [code]void getHomeInfo(Quest01& studentQuest) { cout << "Enter your first name: "; cin >> studentQuest.infoHome.name.nameFirst; }[/code] [editline]8th October 2012[/editline] and then call it with [code]int main() { Quest01 wabbajack; getHomeInfo(wabbajack); /* pretty sure it's like this, i'm no c++ programmer */ }[/code]
it works now yey
[QUOTE=Richy19;37951099]I have an Icosphere and im trying to add height values to it via simplex noise. So I get the noise value for each vertice of each triangle, but how do I convert that into a Vector3 to then add to the current vertice value?[/QUOTE] I'm sorry but there no such thing as a "vertice". The singular form of vertices is vertex. One vertex, two vertices.
[QUOTE]Hey guys, can someone explain to me how to see if I have duplicates of coordinates in an array using GridWorld? [cpp] public static void main(String[] args) { int ysize = 12; int xsize = 12; int gridsize = xsize * ysize; ActorWorld world = new ActorWorld(new BoundedGrid<Actor>(12,12)); world.show(); Fence[] staticFence = new Fence[gridsize]; Fence[] movingFence = new Fence[(xsize - 2) * (ysize - 2)]; // Instantiate a bunch of fences for(int i = 0; i < gridsize; i++) { staticFence[i] = new Fence(); } // Instantiate a bunch of randomized fences for(int i = 0; i < ((xsize - 2) * (ysize - 2)); i++) { movingFence[i] = new Fence(); } // Add fences to the world for(int i = 0; i < 12; i++) { world.add(new Location(i,0), staticFence[i]); world.add(new Location(i, 11), staticFence[i + 12]); world.add(new Location(0,i), staticFence[i + 24]); world.add(new Location(11,i), staticFence[i + 36]); } // Set color White for(int i = 0; i < gridsize; i++) { staticFence[i].setColor(Color.WHITE); } // Add 20 'moving' fence to world Random genRand = new Random(); for(int i = 0; i < 20; i++) { int wildRow = genRand.nextInt(9) + 2; int wildCol = genRand.nextInt(9) + 2; world.add(new Location(wildRow, wildCol), movingFence[i]); System.out.println("Check: (" + wildRow + ", " + wildCol + ")"); } for(int i = 0; i < movingFence.length; i++) { int check = i; for(int j = 0; j < movingFence.length; j++) { if(check == movingFence[j].getLocation()) { } } } /* * for i < array length * check = i * for j < array length * if check = array[j] (Cant do this due to array[j] being a 'Location' not 'int' * world.add(new location (wildRow, wildCol), array[j]) * */ } [/cpp] The code will output a 12x12 square with a grid on it, with 'fences' outlining the grid, and then, inside of the fences, are 20 more, randomized fences. The problem is that sometimes a fence will spawn on top of another fence, meaning I won't get 20, but will get like, 17-19 instead, depending. I've got this that will print something like; [quote] Check: (2, 5) Check: (2, 9) Check: (9, 2) Check: (3, 6) Check: (4, 7) Check: (8, 7) Check: (7, 4) Check: (5, 3) Check: (2, 3) Check: (6, 4) Check: (6, 5) Check: (9, 6) Check: (4, 10) Check: (6, 9) Check: (10, 2) Check: (3, 6) Check: (3, 4) Check: (9, 10) Check: (9, 3) Check: (8, 7) [/quote] But how do I get it to realize that, for instance, there are multiple Location(8,7)s in the array? Do I switch all of this into a list and work from there? I'm completely lost and would appreciate any help.[/QUOTE] Nevermind, I fixed it; If anyone's wondering the GridWorld API has a built in getRandomEmptyLocation function, and I just used that instead of making an array of dudes.
I want to start learning java mainly for minecraft, but yeah, java. does anyone know good resources for this?
[QUOTE=343N;37958509]I want to start learning java mainly for minecraft, but yeah, java. does anyone know good resources for this?[/QUOTE] Like the others kept saying, learn Java first. Spoiler: It's a train wreck. [url]http://docs.oracle.com/javase/tutorial/index.html[/url] [editline]asddsf[/editline] Anyway, I'm now stuck (again), this time on grasping Java. Before, "Give it a shot," that's the problem. I can't figure out how. The objective is: a class [b]Calculate[/b] with the method [b]CalculateBMI[/b] w/ doubles as arguments. Return bmi. Another class called [b]BMI[/b] that extends [b]Calculate[/b] with a method [b]CalculateBMI[/b] and return bmi based on the calculation received from the super class. Then a driver program that collects this data. What would be the first step to figuring this out? Like the syntax and stuff, not asking this to be done for me.
I am trying to learn assembly and have a problem here. I figured out how to print indivudual characters using the bios interupt 0x10. What I want to do now is create a string of characters, which I can then print one after the other in a loop (the loop is not implemented yet). [code] mov al, msg mov ah, 0x0E int 0x10 hang: jmp hang msg: db "W" times 510-($-$$) db 0 db 0x55 db 0xAA [/code] You can easily see what I am trying to do here. The disassembly looks like this: [code] 0: b0 08 mov $0x8,%al 2: b4 0e mov $0xe,%ah 4: cd 10 int $0x10 6: eb fe jmp 0x6 8: 57 push %di ... 1fd: 00 55 aa add %dl,-0x56(%di) [/code] I can already see from this, that it will not work. I have put the adress of the ascii symbol into AL. This is obviously wrong. I don't need the adress to the ascii symbol, I need the ascii symbol itself in AL. I tried it out anyway and it turns out that nothing is printed to the screen. Consequently I tried this: [code] mov al, [msg] mov ah, 0x0E int 0x10 hang: jmp hang msg: db "W" times 510-($-$$) db 0 db 0x55 db 0xAA [/code] The disassembly: [code] 0: a0 09 00 mov 0x9,%al 3: b4 0e mov $0xe,%ah 5: cd 10 int $0x10 7: eb fe jmp 0x7 9: 57 push %di ... 1fe: 55 push %bp 1ff: aa stos %al,%es:(%di) [/code] Not only do I not understand why the disassembly is the way it is now, but after trying out the program, I find out that it prints a heart symbol ????? If anyone could explain the disassembly to me and maybe even explain how to fix the problem, I would be very thankful.
How to make an object with an array that includes x, y, width and height? I don't want to use separate array for them all. Drawbox should look like [b]Drawbox(box[i].x, box[i].y, box[i].w, box[i].h);[/b] HTML5: [code] ... <script> var boxx = new Float32Array(32); var boxy = new Float32Array(32); var boxw = new Float32Array(32); var boxh = new Float32Array(32); var numboxes = 0; function Addbox(x1, y1, w1, h1) { boxx[numboxes] = x1; boxy[numboxes] = y1; boxw[numboxes] = w1; boxh[numboxes] = h1; numboxes++; } function Drawbox(x1, y1, w1, h1) { c.fillStyle = "rgb(100,100,0)"; c.strokeRect(x1, y1, w1, h1); } function Drawboxes() { for(var i=0;i<numboxes;i++) Drawbox(boxx[i], boxy[i], boxw[i], boxh[i]); } ... [/code]
[QUOTE=rute;37970042]How to make an object with an array that includes x, y, width and height? I don't want to use separate array for them all. Drawbox should look like [b]Drawbox(box[i].x, box[i].y, box[i].w, box[i].h);[/b] HTML5: [code] [/QUOTE] Tried using multi-dimensional arrays yet? Basically that way you look up Drawbox(box[i][1], box[i][2], box[i][3], box[i][4]) I'm not really familiar with HTML5, but I bet you can give the secondary arrays values (such as box[i][x], box[i][y])
Does anyone here use Horde3D? I am having trouble getting overlays to work correctly resolution-independently (while retaining their relative position but scaling with the resolution).
I imagine this is extremely easy, and I feel like maybe I'm off to a decent start. I'm a bit confused about how to call a function in C, as I've never really programmed before the last month or two. I have to have four separate functions, main to execute, one to read three integers, one to print the three integers forward, and one to print the integers in reverse. I feel like I've got a decent portion of it correct. Excuse me if it's a tad messy, I'm just trying to understand the syntax at this point I'll worry about the aesthetics a bit later. I'm confused about how to get these functions executed in "main". I think the other functions should work if I can get them to execute. Also, not sure if I'm being redundant as far as the "int printFun ();" and stuff like that goes. Thanks for any help! [code] #include <stdio.h> int readFun (int num1, int num2, int num3); int printFun (); int reverseFun (); int main () { int num1, num2, num3; readFun; printFun; reverseFun; return 0; } /*=================readFun================= This function reads three integers inputted by the user. ===========================================*/ int readFun (int num1,int num2,int num3) { printf ("Please enter three numbers:\n"); scanf ("%d%d%d",&num1,&num2,&num3); return num1,num2,num3; } /*==============printFun=================== This function prints the three integers entered by the user from readFun in order. ===========================================*/ int readFun (int num1, int num2, int num3); int printFun (void) { int num1,num2,num3; return (printf ("%d,%d,%d",num1,num2,num3)); } /*==============reverseFun=================== This function prints the three integers entered by the user from readFun in reverse. ===========================================*/ int readFun (int num1, int num2, int num3); int reverseFun (void) { int num1, num2, num3; return (printf ("%d,%d,%d",num3,num2,num1)); } [/code]
You're calling printf just fine, what's the issue? Re-declaring num1 and friends inside is not something you need or want to do. Get rid of those. Return doesn't need the brackets Additionally, you don't need to include the prototype for readFun before every other function. I'm not sure what you're going for there. Maybe you should simply give the same parameters for each of those, too? [editline]10th October 2012[/editline] Basically, readFun is implemented correctly and your printf calls are correct. Based on those you should be able to figure out more.
[QUOTE=esalaka;37976002]You're calling printf just fine, what's the issue? Re-declaring num1 and friends inside is not something you need or want to do. Get rid of those. Return doesn't need the brackets Additionally, you don't need to include the prototype for readFun before every other function. I'm not sure what you're going for there. Maybe you should simply give the same parameters for each of those, too? [editline]10th October 2012[/editline] Basically, readFun is implemented correctly and your printf calls are correct. Based on those you should be able to figure out more.[/QUOTE] I'll try doing what you suggested, the problem is, I'm not sure if I'm executing them in "main" correctly. Whenever I compile and run the program, it just skips through as though it's completed and doesn't ask for the integers like I need it to.
Well, you see, you aren't calling them at all. See how you're calling printf? With the parameters inside of the parentheses? Do that with your functions as well.
[QUOTE=esalaka;37976082]Well, you see, you aren't calling them at all. See how you're calling printf? With the parameters inside of the parentheses? Do that with your functions as well.[/QUOTE] I really hate to sound daft, but could you please type the portion you're talking about for me? I'm in super unfamiliar territory programming. It's not my strong point at all.
[cpp]printf ("Please enter three numbers:\n");[/cpp] There's your printf call. It's the simplest one possible, with just a string parameter. This is how you call a function. You type its name and then the parameters inside parentheses. Additionally, if you want to be able to access num1 and friends from functions that aren't readFun, do this: [cpp] int reverseFun (int num1, int num2, int num3) { return (printf ("%d,%d,%d",num3,num2,num1)); }[/cpp] ...instead of whatever you are doing now. Remember to add the parameters to the prototypes at the beginning, too. [editline]10th October 2012[/editline] Wait - except that I'm so tired I didn't even notice your readFun makes no sense. It's the only one of the functions which should not have ints as parameters, yet it is the only one that does. [editline]10th October 2012[/editline] I'll just- [cpp] #include <stdio.h> void readFun(int *p_num1, int *p_num2, int *p_num3); void printFun(int num1, int num2, int num3); void reverseFun(int num1, int num2, int num3); int main() { int num1, num2, num3; /* Note how calling a function is done in a manner * very similar to declaring and defining a function. */ readFun(&num1, &num2, &num3); printFun(num1, num2, num3); reverseFun(num1, num2, num3); return 0; } /*=================readFun================= This function reads three integers inputted by the user. ===========================================*/ /* The * before each variable name means it is a pointer * to an integer (int *) instead of an integer (int) * I used pointers here simply because scanf needs them * anyway and if you were trying to use them in scanf * without knowing what they were I might just as well * use them here without further explanation. Consult * the internet or a programming book for more information * on the nature of pointers. */ void readFun(int *p_num1, int *p_num2, int *p_num3) { printf("Please enter three numbers:\n"); scanf("%d,%d,%d", p_num1, p_num2, p_num3); /* Also note that this modified scanf call requires * that you separate the three numbers with commas */ } /*==============printFun=================== This function prints the three integers entered by the user from readFun in order. ===========================================*/ /* The "void" means the function returns nothing. * This is correct. The functions do not need to * return anything because they simply call printf. * However, they do need to have the three parameters * that they pass to printf. These are inside of the * parentheses. */ void printFun(int num1, int num2, int num3) { printf("%d,%d,%d\n", num1, num2, num3); } /*==============reverseFun=================== This function prints the three integers entered by the user from readFun in reverse. ===========================================*/ void reverseFun(int num1, int num2, int num3) { printf("%d,%d,%d\n", num3, num2, num1); /* It is advisable to add a line break (\n) at the end * of each string you are printing. */ } [/cpp]
Someone make mode not hand out bullshit results please. I have spent the last [b]EIGHT[/b] hours trying to figure out how to make it possible and I'm just pissed off now. I just wanna see the completely mind boggling solution. [cpp] #include <cstdlib> #include <iostream> #include <string> #include <sstream> //mode is absolutely fucked up int getSize() { int size; while (true) { std::cout << "Size of array: "; if ((std::cin >> size) && (size > 0)) break; std::cout << "Error: enter a valid number above 0.\n"; } return size; } int* getData(const int size) { std::cout << "\nNumbers of array:\n"; int* array; array = new int[size]; int i = 0, n; while (i < size) { std::cin.clear(); std::cin.ignore(); if (std::cin >> n) array[i++] = n; else std::cout << "Error: enter a valid number.\n"; } return array; } int* sort(int* array, const int size) { int* tempArray = array; //could I just get rid of this and make "int* array" into "int* tempArray"? for (int i = size - 1; i > 0; i--) for (int j = 0; j < i; j++) if (tempArray[j] > tempArray[j + 1]) { int temp = tempArray[j]; tempArray[j] = tempArray[j + 1]; tempArray[j + 1] = temp; } return tempArray; } float mean(const int* array, const int size) { int sum = 0; for (int i = 0; i < size; ++i) sum += array[i]; float tempMean = sum; tempMean /= size; return tempMean; } float median(int* array, const int size) { int* sortArray = sort(array, size); float tempMedian; if ((size % 2) == 0) { tempMedian = array[(size / 2) - 1] + array[(size / 2)]; tempMedian /= 2L; } else tempMedian = array[size / 2]; return tempMedian; } int* mode(int* array, const int size) { int* sortArray = sort(array, size); int maxCombo = 1, numMaxCombo = 1; for (int i = 1, curCombo = 1; i < size; ++i) { if (array[i] == array[i - 1]) ++curCombo; if ((array[i] != array[i - 1]) || (i == (size - 1))) { if (curCombo == maxCombo) ++numMaxCombo; else if (curCombo > maxCombo) { maxCombo = curCombo; numMaxCombo = 1; } curCombo = 1; } } int* modeArray; modeArray = new int[numMaxCombo]; modeArray[0] = numMaxCombo; for (int i = 1, curCombo = 1, eleMaxCombo = 1; i < size; ++i) { if (array[i] == array[i - 1]) ++curCombo; if (curCombo == maxCombo) { modeArray[eleMaxCombo++] = array[i]; curCombo = 1; } if (eleMaxCombo == (numMaxCombo + 1)) { if (maxCombo == 1) return sortArray; } return modeArray; } } std::string modeStr(int* array, const int size) { int* modeArray = mode(array, size); std::string arrayStr; for (int i = 1; i < (modeArray[0] + 1); i++) { std::stringstream convert; convert << modeArray[i]; arrayStr += convert.str() + " "; } return arrayStr; } int main() { int size = getSize(); int* array = getData(size); std::cout << "\nMean: " << mean(array, size); std::cout << "\nMedian: " << median(array, size); std::cout << "\nMode: " << modeStr(array, size) << "\n"; delete [] array; system("PAUSE"); return 0; } [/cpp]
[QUOTE=elevate;37980768] [cpp] int* sort(int* array, const int size) { int* tempArray = array; //could I just get rid of this and make "int* array" into "int* tempArray"? for (int i = size - 1; i > 0; i--) for (int j = 0; j < i; j++) if (tempArray[j] > tempArray[j + 1]) { int temp = tempArray[j]; tempArray[j] = tempArray[j + 1]; tempArray[j + 1] = temp; } return tempArray; }[/cpp][/quote] Yes you can, do something like this: [cpp]void sort(int* array, const int size) { for (int i = size - 1; i > 0; i--) for (int j = 0; j < i; j++) if (array[j] > array[j + 1]) { int temp = array[j]; array[j] = *array[j + 1]; array[j + 1] = temp; } }[/cpp]
Well, you're returning a pointer to a dynamically allocated array of integers, and then you're displaying that. There's no bullshit here. The code is doing exactly what you asked, it's just that what you ask makes no sense.
[QUOTE=Stonecycle;37958773]Like the others kept saying, learn Java first. Spoiler: It's a train wreck. [url]http://docs.oracle.com/javase/tutorial/index.html[/url] [editline]asddsf[/editline] Anyway, I'm now stuck (again), this time on grasping Java. Before, "Give it a shot," that's the problem. I can't figure out how. The objective is: a class [b]Calculate[/b] with the method [b]CalculateBMI[/b] w/ doubles as arguments. Return bmi. Another class called [b]BMI[/b] that extends [b]Calculate[/b] with a method [b]CalculateBMI[/b] and return bmi based on the calculation received from the super class. Then a driver program that collects this data. What would be the first step to figuring this out? Like the syntax and stuff, not asking this to be done for me.[/QUOTE] Well the approach would be to look up inheritance and how to use it. [url]http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html[/url] I am not really sure what is the problem is.
Following the document : [url]http://www.cs.clemson.edu/~dhouse/course…[/url] "If we specify what direction is up for the cam- era by an additional direction vector vup, then we can construct a coordinate system at the viewscreen center using cross products" Im confused as the the vaugeness of 'if we specify', and i assume the particular documentation assumes prior knowledge in the specific subject. I know that the vector Vup is a unit vector in the direction of the camera's local y+ axis, but how is this vector calculated..i assume it cannot simply be specified. Other documents use the camera's pitch yaw and roll to determine the local coordinate axis', however a vector for the camera's "look" direction is already specified, surely meaning that the pitch and yaw are pre-determined, leaving only the roll to dictate the camera's "up". I understand, using the roll, how to calculate the "up" vector, but am confused mainly as to wether I am missing something obvious, assuming that with the number and complexity (minor but still prelevant) of calculations to determine the up vector from the look direction and roll, that it would be at least referenced or mentioned in the documentation. Any help to shed light on this problem is greatly appreciated!
Can anyone with experience in NASM give me a hand? [code] segment .data x dw 7 y dw 2 segment .bss ; … segment .text global _start ; global scope _start: ; main function mov cx, 1 mov bx, 0 label1: mov ax, cx div x cmp ah, 0 jne next mov ax, cx div ax, y cmp ah, 0 jne next add bx, 1 next: add cx, 1 cmp cx, 100 jle label1 exit: mov eax, 1 ; Select system call 1 xor ebx, ebx ; Set default exit code int 0x80 ; Invoke selected system call ; End[/code] e: poopy pantsu
[QUOTE=twoski;37987892] - If the remainder is less than 0 (?????) then jump to next. The remainder will never be less than 0 though so what the fuck. [URL]http://www.cs.uaf.edu/2010/fall/cs301/support/x86/index.html[/URL][/QUOTE] JNE means "jump if not equal" [editline]10th October 2012[/editline] I'm going to make your life (relative to assembly) so goddamn better with this: [URL]http://tuts4you.com/download.php?view.2876[/URL] [editline]10th October 2012[/editline] It documents EVERYTHING.
Okay so for my 3rd year college project I was thinking of doing an AI simulation. I was thinking of having it top down, a single AI at first, just in a house and it interacts with stuff, eventually I was thinking of being able to give the AI a personality the user defines at start up so the AI will do stuff dependant on what mood it's in. Just wondering if anybody here thinks its a good idea for a project and where I should look for some help with this. I'm guessing the hardest part will be collision detection and having the AI move to certain areas freely, but after that I suppose it would be a lot of if statements for the whole mood dependant stuff. I was going to have like a box on the GUI where text will print out what the AI is doing so it could be quite entertaining. So yeah, what would be some good resources for this stuff?
[QUOTE=Lemmingz95;37986933]Following the document : [url]http://www.cs.clemson.edu/~dhouse/course…[/url] "If we specify what direction is up for the cam- era by an additional direction vector vup, then we can construct a coordinate system at the viewscreen center using cross products" Im confused as the the vaugeness of 'if we specify', and i assume the particular documentation assumes prior knowledge in the specific subject. I know that the vector Vup is a unit vector in the direction of the camera's local y+ axis, but how is this vector calculated..i assume it cannot simply be specified. Other documents use the camera's pitch yaw and roll to determine the local coordinate axis', however a vector for the camera's "look" direction is already specified, surely meaning that the pitch and yaw are pre-determined, leaving only the roll to dictate the camera's "up". I understand, using the roll, how to calculate the "up" vector, but am confused mainly as to wether I am missing something obvious, assuming that with the number and complexity (minor but still prelevant) of calculations to determine the up vector from the look direction and roll, that it would be at least referenced or mentioned in the documentation. Any help to shed light on this problem is greatly appreciated![/QUOTE] The up vector is in simple cases (0, 1, 0). That is how you calculate it. There are more advanced ways to calculate up as well, but I never got anything to work. Your link do not work by the way.
Sorry, you need to Log In to post a reply to this thread.