you get hurt coz of the spikes
I put in "the family guy"
you get hurt coz of the spikes
I put in "the family guy"
china town -> hakka noodles
Your syntax seems to be incorrect.
Visit this link for the correct usage of push_back of vector;
You get a world class RPG game (Warcraft anyone ;))
I put in Bill Gates.
Why dont you take the help of the excellent tutorial provided by Mr. Ancient Dragon as an aid in developing your program? If you are expecting someone to give you entire code then that would be err... a wrong assumption.
http://www.crasseux.com/books/ctutorial/Masks.html#Masks
Anyways try to convert the follwing algo to code:
1. Declare a variable "x" and initialize it with the number whose number of bits which are set you want to find.
2. Declare and define a "mask" variable with value 0x00000001 (32 bits with the bit 0 set on Pentium Machine, Small Endian i think is what they call it )
3. Run a loop till the mask variable is not completely 0 ( having value 0x00000000 )
4. AND the variable and the mask variable using & operator and if the resultign value is non zero then it means that the 0th bit of the variable "X" is set ie is 1 and hence increment the value of "bitcount".
5. Left shift the mask variable so that its value is now 0x00000002
6. After teh loop is terminated (when mask becomes 0) print the value of the "bitcount" variable.
If you still cant write a program with the help of the given guidelines then err... god help you.
Best of luck
you are taken in as a developer for Blizzard games (doesnt that make you proud :) )
I put in tornado
who was alone
demon days -> inu yasha
That's machine dependent. It could be signed or unsigned.
Hmm i thought it was compiler dependent...
but then again you might be right.
Look at the sticky at the top of the forums "Starting C" which will be enough to get you strted with.
void BubbleSort(char arrNames[ARRAY_SIZE][25], char Size) { char Hold[25]; for(int Pass = 1; Pass < Size; Pass++) { for(int i = 0; i < Size - 1; i++) { if(strcmp(arrNames[i], arrNames[i + 1]) < 0) { strcpy(Hold, arrNames[i]); strcpy(arrNames[i], arrNames [i + 1]); strcpy(arrNames[i + 1], Hold); } }
On first viewing the code, i see a mistake with your bubble sort logic.
Your both the loops run for SIZE * SIZE times which is not what actually bubble sort is.
As you keep on sorting the arrray one by one you need to shrink the elements which you visit but not visiting the elements which are already sorted.
Try something like this;
void BubbleSort(char arrNames[ARRAY_SIZE][25], char Size)
{
char Hold[25];
for(int i = 0; i < Size - 1; i++)
{
for(int j = i + 1; j < Size ; j++)
{
if(strcmp(arrNames[i], arrNames[j]) > 0) //
{
strcpy(Hold, arrNames[i]);
strcpy(arrNames[i], arrNames [j]);
strcpy(arrNames[j], Hold);
}
}
Hope it helped, bye.
then you are forced to buy viagra (;))
I put in one of the forum moderators (i think my friend wolfpack would be good)
:!: I'm very new to programing, been trying to write this coke machine program. Can anybody help me.
#include<iostream> using std::cout; using std::cin; using std::endl; int getcoins () { int total = 0, number; cout << "put in coins: "; // put in while loop while (total < 65) { cin >> number; if (number == 100) ;! (number == 25) ;! (number && 10) ;! (number & 5) total; += number; // stray semicolon // no need for below stmt // if (total < 65) cout << "add more coins:" << endl; } return total; } //function to see if selection is available bool checkselection (char * machine, char select) { bool isavailable = false; for (int i = 0; i < 9; i++) if (*(machine +i) == select) isavailable = true; //check if c s or d is available *(machine + i) = ' '; //change selected item to space to initiate that it is gone return isAvailable; } int main() { // try a constant size char array for what you want char machine[9] ; // *(machine + 0) = 'c'; // no need of ptr syntax just use normal array one machine [0] = 'c' ; // or initialise and declare at same time char machine[] = {'c', 'c', 'c', 's', 's', 'd', 'd', 'd', 'd', 'd'} ; cout << "\t\t **********************" << endl; cout << "\t\t\tTony's HIP POP SODA MACHINE" << endl; cout << "\t\t **********************" << endl << endl cout << "make selection c …
Oh now it explains everything.
Thanks a lot Miss Dani and my friend Wolfie.
Try something like:
int main()
{
int continue_session = 1 ;
do
{
// your entire code goes here
printf ("do you want to continue (0 if not) ? ") ;
scanf ("%d", &continue_session) ;
}
while ( continue_session != 0 ) ;
return 0;
}
Just make the changes as mentionned by Mr. Salem and try the snippet i have placed in front of you and your program will definately work.
the oak tree
error - exceeds amount of change given!!!
Did i say something wrong ???
Anyways you get dizzy
I put in a software bug.
clint eastwood -> gorillaz
Weird... I just started seeing member certificate from yesterday, and thought it was a new feature but it turns out that it was introduced back in 2004. Hmm... looks like the changes take a lot of time to propagate to my PC
But seriously any theories on why this happened, hoping for a reply from the mods and admins, thanks.
OpenGL is just an API (application programming interface) which is used for plotting points, lines and doing much more complicated 2d and 3d stuff. If you know C and C++ coding in OpenGL should be a piece of cake. You just need to use the inbuilt OpenGL funtions. IF you want to see a sample code in opengl and C you can look here:
http://www.quepublishing.com/articles/article.asp?p=328646&seqNum=4&rl=1
nehe.gamedev.net
Also see the sticky at the top of the forums "Starting C" which has a lot of C and OpenGL related resources.
I see a new feature has been added called member certificates, is it just for fun or does it have some purpose or use ? Just curious (programmer need to be curious, dont they :mrgreen:)
Waiting for your explanation, thanks.
No such thing here, only normal notifications.
How about looking here and trying to understand the given snippet:
http://www.daniweb.com/code/snippet445.html
Hope it helped, bye.
I think due to faulty design you are facing the problem of different seat allocation. YOur class "air" is an abstraction of the airline company but there is no facility for accomodating multiple flights and hence you have to create different instances of "air" for different flights.
Create a new class named "Flight" which would have the data members of "air" and keep a "vector" of "Flight" in your air class so that for a single instance of the "air" class for eg. Sahara, you can have different flights as well as different seats for them.
And i dont get the last part of your question? Z is not passed ?
Please elaborate on the problems and then it would be easy for us to help you.
Try using fgets ()
for reading the contents line by line and try using strtok ()
for tokenising the c style string.
You can find the function prototypes and short examples here:
http://www.cplusplus.com/ref/#libs
http://www.cplusplus.com/ref/#libs
Hope it helped,bye.
Yes Mr. WaltP is correct, when you declare a char it is automatically taken as signed char whose range it think is from -127 to 128 (not very sure).
Try declaring "i" as unsigned char and then try compiling it.
and secret hangout
YOu get cheese sandwich
I put in a diamond necklace.
This?
#include <algorithm> #include <iostream> #include <string> #include <vector> #include <ctime> using namespace std; int main() { srand(time(NULL)); //make it so that everytime you run //the program you get different results vector <string> vc; vc.push_back("susan"); //fill vector vc.push_back("amy"); vc.push_back("heather"); vc.push_back("zoe"); cout << "The original list is:\n"; for ( int i=0; i<vc.size(); i++) { cout << vc[i] <<" "; /*display the original list*/ } random_shuffle(vc.begin(), vc.end()); /* shuffle elements */ cout<<"\n\n\nThe shuffled list is:\n"; for ( int i=0; i<vc.size(); i++) { cout << vc[i] <<" "; } /* display shuffled elements */ cin.get(); }
Hmm i thought he wanted to access the database using the C++ program, pull the data in and then shuffle them. This is the normal shuffling. Anyways you did a great job understanding the guys requirement, which were pretty er... vague.
Texas => cowboys
you get electromagnetic waves messing around with your brain signals (making it difficult for you to think :))
I put in a blanket.
set off to..
dedication
Without dedication there is no point in programming just for hte sake of doing it.
We didnt mean to hurt to or something like that. Its just that you didnt even mention your problem approach or didnt even post your effort, so it made us think you want ready made solution.
POst some of your efforts or the info you have gathered to prove your point that you are genuinely interested.
and thus said
YOu are lost in space (only you :) ).
I put in a cotton candy.
You get 3 KG :D
I put in VLC player (a type of media player)
Comedy
Life is a tragedy for those who feel and comedy for those who think
You get mobile revolution
I put in our World
If you have a dilemma post the real question to your dilemma instead of being vague all over. And whats up with this kind of attitude? Maintain it and you would be sure to make a lot many friends here.
And as far as pushing on to the next thing is concerned, this is a public forum where everyone is free to post whatever they like unless the content is filtered by the moderator. So if you dont want to get disturbed with these dilemmas move on to a Pay Site for homework help or learn to live with this.
Try out something like:
#ifndef SAVINGSACCOUNT1_H
#define SAVINGSACCOUNT1_H
class SavingsAccount
{
private:
float annualInterestRate;
float savingsBalance;
public:
SavingsAccount()
{
annualInterestRate = 0;
savingsBalance= 0;
}
SavingsAccount (float my_interest_rate, float my_savings_balance)
{
annualInterestRate = my_interest_rate ;
savingsBalance = my_savings_balance ;
}
float calculateMonthlyInterest()
{
float subtotal = 0;
float monthlyint = 0;
subtotal = savingsBalance * annualInterestRate;
monthlyint = subtotal / 12;
savingsBalance = monthlyint + savingsBalance;
return savingsBalance;
}
void setInterestRate (float my_interest_rate)
{
annualInterestRate = my_interest_rate ;
}
void printSavingsBalance()
{
cout << "Your balance is: $" << savingsBalance << endl;
}
};
#endif
#include <iostream>
#include "SavingsAccount.h"
using namespace std;
int main()
{
SavingsAccount saver1 (1, 2) ; //instantiate saver1;
SavingsAccount saver2 (2, 3) ; //instantiate saver2;
saver1.printSavingsBalance();
cout << "Interest of Month #1" << saver1.calculateMonthlyInterest() << endl;
saver1.setInterestRate (4);
cout << "Interest of Month #2" << saver1.calculateMonthlyInterest() << endl;
return 0;
}
Hope it helped, bye.
c++ or c programs (or programs written in any other language for that matter) are unreliable at best because the os may overwrite the sectors on the next write. Even Norton Utilities is not all that reliable. MS-Windows added the trash can for exactly that purpose, when a file is deleted the os moves it into the recycle bin directory and does not really delete it at all. It would be pretty easy to write a program to move files and directories back to their original location.
But what you say beats the purpose of the OP. And also in the market there are a lot of file recovery softwares which recover files which are deleted using SHIFT + DEL. And as they are softwares, they are naturally made in some language (i think C/C++), aren't they?
Maybe you should start here:
http://www.daniweb.com/techtalkforums/forum16.html
Hope it helped, bye.
Yeah, :P kind of communication gap.
Just thought that someone with 3 posts wouldnt want to probably write a recovery software (which is a VERY challenging project).
Dude , you need to do a reality check since if you are clueless about how to start, managing this project would be near impossible (you know i am optimistic).
Tell us how much C++ you know, and what is the complexity of the biggest program you have written till date.
Why not modify the game in a way that the user posts the word and explains its importance or its disadvantages in life?
relentless
Its only after your relentless efforts you gain something in life.
Yeah post your effort here and then maybe we would be able to help you out, just asking for code here would not fetch much help.
This is the wrong forum for this kind of question and we dont give readymade answers in this forum. Post your effort in correct forum and then maybe you can get the answer to your question.
If you want the program to recover the files which you deleted by mistake then you are posting in the wrong forum but still can take a look here:
http://www.pcworld.com/downloads/file/fid,23069-order,1-page,1-c,utilities/description.html
http://www.diskinternals.com/
Hope it helped, bye.
Create a new thread for your questions. Dont hijack other peoples threads.