2,712 Posted Topics
| |
Re: where are you defining the userIn1 in your main function? | |
Re: Your porblem was : [code] Shapes::Shapes(char shape, int x, int y, int width, int height); <--THIS SEMICOLON { cout << "You created a: " << shape " shape. At X: " << x " At Y: " << y " Width: " << width " Height: " << height << … | |
Re: "What the diffrent bettween while looping, conter-controlled while loop, sentinel-controlled while loop,flag-controlled while loop, do while loop and For loop. " Their syntax and spelling:) | |
Re: short answer : change [code] void printtext(char **lotsoftext,int m,int n) [/code] to [code] void printtext(const char **lotsoftext,int m,int n) [/code] Just a side note, when your function does not change the content of its arguments thats passed, then make them const. | |
Re: Yes, and if your compiler does not support the keyword export, then it has to be in the same file. (note not tested) For example : [code] //pair.h #ifndef PAIR_H_ #define PAIR_H template<typename Type, template Type2> class Pair { private: Type first; Type second; public: Pair() : first(0), second(0) { … | |
Re: Its simple as this [code] float a = 3.1234567; float b = int (a * 1000 ) / 1000.0f // now b = 3.123 [/code] | |
Re: Lets see what you are doing : [code] #include <iostream> #include <cmath> using namespace std; int main() { int a, result, factorial(a); //declare 'a' as an int //declare 'result 'as an int //declare 'factorial' as in int, initialized to //the value of 'a' which is ? junk... { cout << … | |
Re: "I just want to have random numbers which are unique." So whats the problem. Are you stuck somewhere, trying to implement this? How about a trial and show us where/if you have problems. Since its only 5 numbers, you can create an array that holds say 5 elements. Then fill … | |
Re: What you are doing is very dangerous! [code] bool *dat; //create a bool pointer dat=new bool; //set bool pointing to a address, i.e pointer-to-bool dat=true; //give value to the pointed address ++dat; //increase the address of bool. Huh-oh, but where is the //next address. Even worse, what does that address … | |
Re: Now try a recursion functions for this job. 1) Find a base case. 2) Find a pattern. 3) Recurse pattern until base case is reached. Also no need to worry about the little details right now. Just keep it in mind. | |
Re: not sure what you are asking for. Maybe some code would help. | |
Re: when your display value reaches 60, you add 1 to minutes, and keep doing this until your minutes adds to 1 hour; Try this circular loop : [code] displayValue = ++displayValue % 60; min = displayValue % 60 + displayValue/60 hour = min % 60 + min/60 [/code] | |
Re: Here is one way of doing it. [code] int Array[5] = {0}; int num(0); //the number the use will input; for(int i = 0; i < 5; i++) { cout<<"Enter value# "<<i<<": "; cin >> num; if( num >=5 && num <= 15) //put number into array only if its … | |
Re: Yes its normal. The first window is from your compiler, and the second is where you render you objects. It will be useful when you need to debug you application. | |
Re: common mistake : [code] while (qAnswer = 'y'); [/code] should be [code] while (qAnswer == 'y'); [/code] You understand the difference between '=' and '==' right? | |
Re: Could you give us more information , so we can answer your question better. Not that most will hand you the answer without seeing you suffer:) | |
Re: You might want to try a more general approach, where the user gets to input the number of rows for the tree. | |
Re: Not sure what you mean. Maybe an example would help | |
I tried to install the devil library but I am getting some errors. Here are the steps that I am taking to install it : [code] Let me see if I did this correctly : Steps : 1) download DevIL 1.7.8 for windows 32 bit 2) extract the info to … | |
Re: use ifstream then : [code] int main() { cout<<"Enter file name (with extension): " char filename[1024] = {0}; cin >> filename; ifstream iFile(filename); ...//do some stuff } [/code] | |
Re: just to help start you off (from how I interpret the problem ): Steps : 1) declare variable for input 2) get user's input via cin 3) have a class ready to pass the variable to its consturctor 4) inside constructor decide which class the students get 5) print the … | |
I am using c++/opengl. Can someone help me with a wrapper for a 2d ball representation. I have one but its not complete. I need other stuff like momentum and collision response. Can you help me implement this? | |
How could one share a .exe that loads textures. I am using c++ and openGL. I want to share the .exe that I made using rapidshare. | |
I know that it returns the remainder but what happens when say : x% y, where x,y is int and x<y. I see that results in x; For example, 3% 101232 = 3 and similarly 3%y, where y is greater than 3 yields 3. Why is that> Just wonder the … | |
Re: What you want to achieve will take a lot code than what you might expect. I would recommend to use '*' as un-fliped mode so the user wont get confused. | |
I just started a few days ago. I am troubled with the input in c#, even though I got it to work. Any comment would be helpful. Its a Number Guessing game and a tic-tac-toe game. [code] using System; namespace GAME { #region NUMBER GUESSING GAME public class Number_Guess { … | |
I am trying to rotate the object by a input of key. I dont know why the object is not rotating. I used glRotatef(x,0,0,1); //where x is declared as float : here is my code : [code] #include<GL/glut.h> GLfloat x = 10; void initGL() { glEnable(GL_DEPTH); glDepthFunc(GL_LEQUAL); glClearDepth(1.0f); } void … | |
Re: Know : C/C++ Python java OpenGL DirectX Depending on you situation, your son should learn the list above , although c++ and opengl/directx should be more important than others. Also check out community colleges, and talk to them for what courses they offers, with regards to programming. Or even check … | |
Re: try to zip it up. If you have visual studio 8. Then build your code. Then open my computer. Go to C: , then find visual studi 2008. Then find you project name. Then search the folder for .exe file. Clik on it to make sure it works. Then right … | |
how would you seperate a character in a string. For example : string ="2x^2+8" how would i seperate the string into '2' 'x' '^' '2' '8'. so I could find its derivative. | |
Re: example of cin.get(). say a file called num.txt contains the following : 12345677700234. using cin.get() would first get the number 1, then it may be easier to imagine an arrow pointing to the number 2 , because the number 1 has already been extracted. Then using cin.get() again would ger … | |
hi, I am confused on why my texture came out a different color? I have a bmp file of a cloud, skyblue color on the background and white clouds. BUt when i load it on a square the color becomes pinkish for background and cloud is white? Why pink-ish? here … | |
hi, I am trying to draw a circle without using cos,sin; Mainly by the formula x^2+y^2 = r^2; this is my code , but for some reason its not working. any help? note: I thought this code would draw the upper halve fo the portion. float xCor,yCor; xCor=yCor =0.0; float … | |
hey, I am just learning textures in OpenGl, from a certain tutorial site : [URL="http://www.spacesimulator.net/tut3_texturemapping.html"]http://www.spacesimulator.net/tut3_texturemapping.html[/URL] the site had a good tutorial for texture, but after loading the .bmp picture, it goes to create its own function for vertex3f and such ( I think). In any matter, I have not learned … | |
i am writing a code that will rotate the polygon but it seem as if it is not working any help? [code] #include<iostream> #include<Gl/glut.h> #include<cstdlib> using namespace std; GLfloat fPent = 0.0; // for rotating pentagon; GLfloat fSqr = 0.0; // for rotating square; void handleKeyPress(unsigned char key, int x, … | |
I am practicing lighting and smooth shading. THe problem is that this code only shines the light for front and the right side , but when the objected is rotated, it shines at constant position (the front and right) and not to the side that are on the positioned light. … | |
Re: You should look at the unit circle. So obj 1 has a velocity of 0 in direction 3pi/4(south) and you want it to face northeast towards the obj 2. so you need to rotate obj one anti clockwise on the angle pi/4. this is a hint try to figure it … | |
Re: first off iostream.h is not standard so dont bother using it. use #include<iostream> instead. to solve your problem try doing this : [code=cplusplus] #include<iostream> using namespace std; //important. int main(){ cout<<"Hello world."<<endl; return 0; } [/code] | |
hi, I started learning openGl yesterday. I made a simple program that supposed to create a triangle and a square, but its not working properly, any help please? [code] #include<iostream> #include<Gl/glut.h> #include<cstdlib> using namespace std; void handleKeyPress(unsigned char key, int x, int y) { if(key == 26) exit(1); } int … | |
Re: First of, You should get very familar with C++( if you don't know it already). Then after you are comfortable with C++. Then you will know how to make text based game. note: atleast learn up to classes in C++. Then go to youtube or google text game in C++. … | |
What is the first term in the Fibonacci sequence to contain 1000 digits? so i made a program that finds the fibonocci's sequence (fs). I tried to do it recursively but it takes too long for big numbers. so i made a manual one. BUt as i count how many … | |
I am just curious, just how much of math do one really needs in order to make, say space invaderes, or pacman....WOW,..NBA LIVE 2009? It's not that i am bad at math or anything, in fact I am pretty good at it and still learning, calc.II. BUt i am curious, … | |
Re: your problem is your cout statement. instead of cout<<mat[l]; it should be cout<<mat[l][k]; | |
#include<iostream> #include<fstream> #include<cmath> #include<iomanip> using namespace std; /* 215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^1000? */ //my logic is to export 2^1000 into a text … | |
hi, I am curious, how can I read a int from a text file( ex. num.txt). but this text file contains numbers without spacing (ex.1212132132313... 23156897984969.. 583852935792...) The problem is that this file has no spaces between numbers and when i try to read it into an arry, the result … | |
how would I check how long a program takes for it to be completed. (i.e the time it takes for the program to be finished doing its calculation)) Thanks | |
[code]#include<iostream> #include<fstream> #include<cmath> #include<iomanip> using namespace std; unsigned __int64 Fact(unsigned __int64 x ); int main(){ /*n! means n (n 1) ... 3 2 1 Find the sum of the digits in the number 100!*/ cout<<Fact(100); } unsigned __int64 Fact(unsigned __int64 x ) { __int64 num(0); if(x==0) return 1; else { … |
The End.