• Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About ZodiaXlll

  • Rank
  1. problem with c(input data)

    #include <stdio.h> #include <math.h> #include <conio.h> #define G 32.17 double ftime(double t, double d, double v); double fheight(double t, double time, double v); int main() { double theta; double distance; double velocity; double time, height; printf("Please input angle(in radian)\n"); scanf("&f",&theta); printf("Please input distance to target\n"); scanf("&f", &distance); printf("Please input velocity\n"); scanf("&f", &velocity); time = ftime(theta, distance, velocity); height = fheight(theta, time, velocity); return 0; } double ftime(double t, double d, double v) { double time; time = d/v*cos(t); printf("time taken for obj to reach the target is %f\n", &time); return time; } double fheight(double t, double time, double v) { double height; height = v*sin(t)*time - G*time*time/2; printf("height at impact is %f\n", &height); return height; } My problem is after I input radian(the first data) it ignore the other input data and run through the end. How can I fix this problem? Thank you.
  2. for (int vertex = 0; vertex < numberOfSides; vertex++) { // calculate the angle of the current vertex float angle = (float)vertex * 2.0f * (float)PI/numberOfSides; // draw the current vertex at the correct radius glVertex3f(cosf(angle)*radius, 0.0, sinf(angle)*radius); } I confuse about this formula, angle that calculates from (float)vertex * 2.0f * (float)PI/numberOfSides; will be radian right? but what we needed to use in sin and cos is an angle,but when I try float angle = (float)vertex *360/numberOfSides; it not show the correct result,so I want to know if I miss any concepts of this thing?
  3. I am very very newb here.After finish reading C++ , I try to read about openGL and I started with redbook, in chapter2 it talk about drawing line and polygon. It contains many code that I don't understand. After I tried to read it through I have some question that I don't understand about openGl that is what openGL can do ? It do only graphic(I look through contents and it contain mostly abt graphic) ?and what different between openGl and 3d engine like MAYA or 3dmak? I have read introduction about openGL and it say that openGl is software interface to graphic hardware, so what can it do with game programming ?
  4. What books should I start with?

    Thank you very much for your advise. I think I would start to work on an openGL.
  5. What books should I start with?

    I had read some books of C and C++ (in Thai text(I am Thai)) and try to move on to game programming,but it has only one Thai book that write about game programming with directx, so it would be great if you can give me some advice on what book or free source on internet I should use for game programming.
  6. problem about header file in c++

    Thank you
  7. problem about header file in c++

    This is another one error from another work //student.h #ifndef STUDENT_H #define STUDENT_H #include <iostream> using namespace std; #include <cstring> enum stTypes {_Students, _Bachelor}; class Students{ private: char* pName; int size; unsigned idstudent; protected: stTypes _types; public: Students(const char* pN,unsigned id=0); ~Students(); }; #endif //student.cpp #include <iostream> using namespace std; #include "student.h" #include <cstring> Students::Students(const char* pN,unsigned id): idstudent(id), _types(_Students){ size=static_cast<int>(strlen(pN)); pName=new char[size+1]; strcpy(pName,pN); }; Students::~Students{ delete [] pName; }; } //ustudent.cpp #include <iostream> using namespace std; #include "student.h" int main(){ const int size =4; Students stu("a boy",30466); return 0; } Compiling... student.cpp C:\Program Files\Microsoft Visual Studio\MyProjects\HEADER\student.cpp(11) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Error executing cl.exe. HEADER.exe - 1 error(s), 0 warning(s)
  8. problem about header file in c++

    It still show an error even #endif is added. This is error messages. c:\program files\microsoft visual studio\myprojects\board\stu.h(3) : error C2143: syntax error : missing ';' before '<class-head>' c:\program files\microsoft visual studio\myprojects\board\stu.h(3) : fatal error C1004: unexpected end of file found
  9. After finished reading some C++ book I started to test how it work on VC++ 6.0 and in the book it seperate header into 2 parts 1. XXX.h and 2. XXX.cpp and use it on uXXX.cpp, but I don't know how to build it in VC++. First I create project of win32 console app,then I created c++ header file forstring.h and created c++source file for string.cpp and ustring.cpp,but it did't work and show an error, so I want to know if I do something wrong and how to fix it. Thank and sorry for my bad grammar - -a //string.h #ifndef STRING_H #define STRING_H class String{ private: char* pstr; int size; public: String(const char* str=" "); ~String(){ delete [] pstr}; }; #endif //string.cpp #include <iostream> using namespace std; #include <cstring> #include <cassert> #include "string.h" String::String(const char* str){ size=static_cast<int>(strlen(str)); pstr = new char[size+1]; strcpy(pstr,str); } //uString.cpp #include <iostream> using namespace std #include "string.h" void main(){ String str1("welcome"); } [Edited by - ZodiaXlll on April 16, 2006 9:40:15 AM]