- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 3
- Posts with Upvotes
- 3
- Upvoting Members
- 3
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
87 Posted Topics
Re: The reason RAND_MAX exists is for the maximum digit the rand() function can return. If you want a quick and dirty random number just use the modulus. Like this: [code] #include <stdlib.h> /*Or <cstdlib> for C++*/ int main() { /*Will return a number between 0 - 9*/ int number = … | |
Re: Please use [url=http://daniweb.com/techtalkforums/announcement.php?f=8&announcementid=3]code tags[/url] Remeber you are working with a specific range so you are going to need to use the && in your get letter grade function. Also that function needs some other adjustments. You also need to call it from main. Did you even go to class? | |
Re: Well you can read this why gets is bad [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1049157810&id=1043284351[/url] | |
Re: Read this on random numbers [url]http://www.eternallyconfuzzled.com/tuts/random.html[/url] | |
Re: Couldn't you just do something like this? Remeber if this sucks I am not good at the API ;) [code] #include <windows.h> #include <iostream> int main() { char buf[30] = {'\0'}; //Null terminate LPVOID lpMsgBuf; DWORD byteWritten = 0; HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); BOOL ReadFileReturn; HANDLE hFile = CreateFile("MYFILE.TXT", // … | |
Re: Well for one you declare a array with 41 elements and only seem to need 5. And the lovely thing about fstream is operator overloading so if you want to read in something it's very easy. [code] [COLOR=#0000FF]#include[/COLOR] <iostream> [COLOR=#0000FF]#include[/COLOR] <fstream> [COLOR=#0000FF]int[/COLOR] main() { [COLOR=#0000FF]int[/COLOR] i = 0; [COLOR=#0000FF]int[/COLOR] array[5]; … | |
Re: [url=http://daniweb.com/techtalkforums/announcement8-3.html][c[b][/b]ode][/c[b][/b]ode] [/url]Tags | |
Re: I am not sure what a viva is but it sounds like a test or quiz or homework, so [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url]. Maybe if you explain what you were thinking the answers are we will be more than glad to help you out. | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement.php?f=8&announcementid=3[/url] | |
Re: I wonder when I get a job if I can post my work and ask people to fill in the blanks for me. Moral of the story what do you need help with not I need help heres my code fill it in. | |
Re: Ummm. Do your own work [quote] Write a "Hello World" program in 'C' without using a semicolon [/quote] Who comes up with these brilliant ideas? | |
Re: Well the linking error means it finds the prototype of the function but doesn't find the actual defination of the function. I am not sure why it does that since I would not be an VC++ expert. Maybe look up how the pragma comment has to be. | |
Re: Narue, What are you talking about professors know everything....... | |
Re: Well. You should change the Person::function(). To p.function(). [code] std::ostream &operator<<(std::ostream &stream,const Person &p) [/code] | |
Re: Welcome to the forums. 1. When you have a problem(s). Ask a question releating to that problem. 2. Post any realated code with the problem. 3. Wait until someone like me, who is a genius, to help you with your problem ;). Enjoy your stay at the Daniweb C And … | |
Re: atoi for converting a char * to an int C or Or stringstreams for C++ | |
Re: Well there are many different options. If you are looking for some sound libary you can use [url=http://dumb.sourceforge.net/index.php?page=about]DUMB[/url]. Or you can check out [url=http://www.libsdl.org/index.php]SDL[/url]. Or [url=http://www.fmod.org/]Fmod[/url]. But as far as posting code with a graphic and sound that would probably be no use to you. | |
Re: Good? That is a very broad question. 3D programming is a combo of knowing your the language, knowing some good math and alot of patience. This is not from personal experiance just from looking at some 3d stuff. Here is the best openGL site as far as I know [url]http://nehe.gamedev.net/[/url] | |
Re: Like to spam boards? [url]http://cboard.cprogramming.com/showthread.php?t=70252[/url] | |
Re: I am not sure what you wanted this compiles and runs so here added comments for some info. [code] #include <iostream>//This is the proper header. using namespace std;//Put everything in the std namespace //not always the best idea but the easiest class Positive_Fraction { public: Positive_Fraction(); Positive_Fraction(int,int); void Print(); // … | |
Re: So what exactly is your question? Do you need to know how to average, find the second highest, print out the color assiocated with the number? | |
Re: You would need to change your [] operator to return a reference and then you could use that as you would. | |
Re: Ussually when you are writting the + operator it is not really a member function of a class here is how I would implement it [code] #include <iostream> #include <ostream> class someClass { public: int getX(); void setX(const int &toSet); someClass &operator=(const someClass &toSet); someClass &operator+=(const someClass &toAppend); friend someClass … | |
Re: What? You need to show some code so we can see what your problem is. | |
Re: Here: [code] while(1) { //your code here } [/code] | |
Re: [QUOTE=sunnypalsingh]yaa you an do that but it will be unncessary burden for you i'll suggest you to go for turbo c++ compiler in case you want use graphics it fully supports it[/QUOTE] Gooog. Don't recommend that compiler. Go and get a graphics lib like SDL or Allegro you can draw … | |
| |
Re: Code tags please. >what are the member functions here of class Record that can access private data of class Record. Any member function of it own class can access the private data of its class. >and which member functions of class Record can access private data of class Music. None … | |
Re: Here you go. [code] if(upkeypressed) { yPos--; } if(downkeypressed) { yPos++; } [/code] | |
Re: Post questions and if he is intrested he will answer or others will if they are. | |
Re: Here we go. [code] #include<conio.h> //Non standard header do you really "need" it? //This is the way the headers are no .h's #include<cstdio> #include<iostream> #include<string> //Got to put it in the std namespace using namespace std; //I would recommend some minor style changes. class link_stack { struct node { int … | |
Re: -masm=intel in the compiler options | |
Re: Read This [url]http://www.daniweb.com/techtalkforums/announcement.php?f=8&announcementid=3[/url] | |
Re: I would recommend that you don't use a system("pause"). | |
Re: There is no way with cin>> because the input is buffered. | |
Re: Or you could be smart and not use a system command. [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1042856625&id=1043284385[/url] | |
Re: Yes. I believe it is beacuse you defined you operator = with just a reference and not a value. Which the sample_manipulation returns. [code] #ifndef REF_H #define REF_H template<typename T> class ref; template<typename T1, typename T2> ref<T1> ref_cast(ref<T2>& r2) { return ref<T1>(static_cast<T1>(r2.c_ptr()), r2.num_ref()+1); } template<typename T> class ref { private … | |
Re: [url=http://daniweb.com/techtalkforums/announcement8-3.html]Code Tags![/url] oh and void main is wrong it should be int main. | |
Re: Why are you dynamically allocating total why not just use a regular int? | |
![]() | Re: It because you are setting the area at the begging to a garbage value if you want to update the area set it to height * width after the values are inputted ![]() |
Re: [url=http://daniweb.com/techtalkforums/announcement8-3.html]Code Tags![/url] | |
Re: Are you trying to define that function outside of the header? That ussually can cause problems. | |
Re: [url=http://daniweb.com/techtalkforums/announcement8-3.html]Code Tags![/url] | |
Re: Code tags please. [url]http://daniweb.com/techtalkforums/announcement8-3.html[/url]. Also it is int main not void main. | |
Re: [url]http://daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: There is no way to do that using just good ol C++. You would have to go into system dependent console stuff. If you are using windows check out this site for a look into how to do some window console specific stuff. [url]http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles1.html[/url] | |
Re: [quote] First, how do you feel about operator overloading? [/quote] As Narue says it is handy sometimes but it really isn't necessary but I do use it ;) [quote] Second, I am thinking of buying Visual Studio 2003... I can get it at a pretty good price and was just … | |
Re: "*" are pointers they point to a memory address. Dave and Narue are not trying to be mean and cryptic. They are just trying to get you to work things out on your own. Most of us fell that it is a disservice to tell you everything and you not … | |
Re: 1. Use complete sentences to describe what you are trying to accomplish so someone can understand what you are asking. So they do not have to lower themselves to a third grade level of reading to know what you are trying to ask. 2. Use code tags when posting code. … |
The End.