+ 1
Can someone please help me do my project? I need to present a nice c++ program, but I have no idea how to do it. Please help me.
C++ PROJECT HELP
101 Antworten
+ 2
@kinshuk
i really want my program to be like this?
there will be a cout like, "place your bet!" then your gonna place your bet name on your bet
then if you win, there will be a cout that you won. like "congratulations! you won!" like that 😁
+ 6
Do you think they cheated?
+ 6
If you want an idea. Maybe a simulated horse race. Just line up and results. no graphics
+ 6
make a class called Horse. From it spawn a bunch of horses. Store them in an array. Select the winner at random? not a great program but it would be entirely your work
+ 6
I suspect none of your class mates did it themselves either
+ 6
lol.. Kinshuk.. love the "..... this was missing" comment.
I don't know how long this class has been going for him but clearly he has not been paying attention. What I would have given to have a programming class at school.
Oh well. One can only hope the teacher doesn't asks him exactly how it works. By his own admission it is due in a few days.. no time to learn left... *sigh*
+ 5
how much c++ do you know?
+ 5
not sure anyone will just give you the entire code.
If you start your project in code playground (doesnt matter if you fail, thats part of learning) and post what you come up with here I will help you work through it.
That way, not only will you learn but when the professor asks how does this work? you will be able to answer him.
+ 5
There was not enough room here for corrections.
You have gone and done alot, much of which is not really needed yet. :D I have made the program work to a point. A winner will be chosen at random from the list. I have kept alot of the code you had there, but commented it out and added notes as to what I changed and why. You can use this as a base to find who came second and third. As you will see there is much less code required to find a winner than what you had thought.
https://code.sololearn.com/cN0y4g3QQQcg/#cpp
+ 5
I have told you how to fix.. I am not going to do anymore. May as well submit it my name if I do more
+ 4
I have a dentist appointment now. I will help create a lotto generator but I want you to attempt it while I am gone. I will give you some hints to work with
for(int i = 0; i < maxLottoNumbers; i++) {
lottoNumber[i] = rand(time(0));
}
this will be used to generate the actual numbers. It is not 100% right as it has no highest number limit. Google rand to see how it works. I will be back in a bit over an hour
+ 4
I can help you, what type of project do you wish to create?
Is it for school?
I am currently making an Airline Reservation System for my 12th Project, as my teacher rejected the Video Poker Game and the Matrix Class I made, idk why...
//This is what you get in India if you make a project the teacher cannot ever make...
+ 4
@James: Yeah that was I was sorta getting at re: getting others to give code/the solution
@Janeiro. Have you decided on a project? Any progress?
+ 4
@Kinshuk: lol what? Those projects are awesome?! Rejected wow
+ 4
nice! i can see something straight away.
move return 0 at the top to the bottom as a replacement for return = 0
+ 4
mmhmm I was out doing groceries. I am back now
+ 4
Here is a more standard way to do an array:
#include<iostream>
#include <array>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
const int numberOfHorses = 4;
array<char, numberOfHorses> horse;
srand(time(NULL));
horse[0] = 'A';
horse[1] = 'B';
horse[2] = 'C';
horse[3] = 'D';
int winner;
winner = rand() % numberOfHorses;
cout << "winning horse: " << horse[winner] << endl;
return 0;
}
+ 4
u are not serious.. are you....
+ 4
It is error because i purposely left out the random number selection bit from secondplace.. it is a copy and paste to fix it.
See winner =
+ 4
Wouldnt you rather fail on your own effort than pass by lying?