Click here to Skip to main content
15,908,768 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: setting pixels colors Pin
Chris Losinger2-May-02 11:38
professionalChris Losinger2-May-02 11:38 
GeneralRe: setting pixels colors Pin
Jack Handy2-May-02 12:18
Jack Handy2-May-02 12:18 
GeneralRe: setting pixels colors Pin
Chris Losinger2-May-02 12:46
professionalChris Losinger2-May-02 12:46 
GeneralI NEED HELP!!! Pin
Donna2-May-02 8:19
Donna2-May-02 8:19 
GeneralRe: I NEED HELP!!! Pin
Ravi Bhavnani2-May-02 8:32
professionalRavi Bhavnani2-May-02 8:32 
GeneralRe: I NEED HELP!!! Pin
Donna2-May-02 8:39
Donna2-May-02 8:39 
GeneralRe: I NEED HELP!!! Pin
Maximilien2-May-02 9:44
Maximilien2-May-02 9:44 
GeneralRe: I NEED HELP!!! Pin
Donna2-May-02 9:52
Donna2-May-02 9:52 
As you will see, I am extremely new at this but here is what I have so far:

#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <time.h>


void lotteryNbr(int[], const int);
int linearSearch(int[], int, const int);

int main(){

char names [20];
const int sizeOfArray = 6;
int num[6],a[sizeOfArray],element;



cout <<"Please enter your first name " << endl;
cin >> names;

cout <<"Hi, "<< names << "!" <<" What numbers did you pick for";
cout <<" this weekends lottery drawing?" << endl;
cout <<"(6 integers between 1 and 48, no duplicates!)"<< endl;

for (int i = 0; i < 6; ++i){
cin >> num[i];

}

lotteryNbr(a,sizeOfArray);


element = linearSearch(a, num[i], sizeOfArray);

if (element != -1)
cout << "You have won the lottery!" << endl;
else
cout << "Sorry Frown | :( you didn't match any numbers." << endl;


return 0;
}



void lotteryNbr(int gameNbr[], const int arraySize)
{
cout << "This weeks lottery numbers are " << endl;
srand(time(0));
for (int j = 0; j < 6; ++j){
gameNbr[j]=(1 + rand() % 6);
cout << gameNbr[j]<< endl;
}
}


int linearSearch(int array[], int key, const int arrayLength)
{
for (int n = 0; n < arrayLength; ++n)
if (array[n] == key)
return n;

return -1;
}
GeneralRe: I NEED HELP!!! Pin
Maximilien2-May-02 11:08
Maximilien2-May-02 11:08 
GeneralRe: I NEED HELP!!! Pin
Maximilien2-May-02 11:09
Maximilien2-May-02 11:09 
GeneralRe: I NEED HELP!!! Pin
Christian Graus2-May-02 12:27
protectorChristian Graus2-May-02 12:27 
GeneralRe: I NEED HELP!!! Pin
Christian Graus2-May-02 12:26
protectorChristian Graus2-May-02 12:26 
GeneralRe: I NEED HELP!!! Pin
Maxwell Chen2-May-02 19:37
Maxwell Chen2-May-02 19:37 
GeneralRe: I NEED HELP!!! Pin
Donna3-May-02 18:07
Donna3-May-02 18:07 
GeneralRe: I NEED HELP!!! Pin
Christian Graus3-May-02 18:19
protectorChristian Graus3-May-02 18:19 
GeneralThe escape sequence in HTML. Pin
Maxwell Chen3-May-02 22:26
Maxwell Chen3-May-02 22:26 
GeneralDDEML Pin
Valeria2-May-02 8:08
Valeria2-May-02 8:08 
GeneralRe: DDEML Pin
Tim Smith2-May-02 8:19
Tim Smith2-May-02 8:19 
GeneralRe: DDEML Pin
Valeria2-May-02 9:34
Valeria2-May-02 9:34 
QuestionHow do you load a bitmap? Pin
atomicluis2-May-02 7:58
atomicluis2-May-02 7:58 
AnswerRe: How do you load a bitmap? Pin
Philip Patrick2-May-02 10:20
professionalPhilip Patrick2-May-02 10:20 
GeneralStupid Task List.... Pin
nw603122-May-02 7:10
nw603122-May-02 7:10 
GeneralRe: Stupid Task List.... Pin
Tom Archer2-May-02 7:57
Tom Archer2-May-02 7:57 
GeneralFTP And sockets Pin
Aaron Schaefer2-May-02 5:52
Aaron Schaefer2-May-02 5:52 
GeneralBuilding C++ Application Pin
Stew2-May-02 5:48
Stew2-May-02 5:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.