All pastes #221324 Raw Edit

Fegis

public cpp v1 · immutable
#221324 ·published 2006-10-25 17:03 UTC
rendered paste body
#include <stdio.h>#include <iostream.h>#include <time.h>#include <stdlib.h>#include <string> const int MAX_LENGHT = 7; int findNumber(int num, int arr[]);int resetArray(int arr[]);  int main(int argc, char *argv[]){  int val1,  val2 = 1,  STrad,  lottorad,  STradprint,  run,  x,  lottoradprint,  maltipsrader,  i,  rnumber,  exists,  arr[MAX_LENGHT];    do{   cout << "1. Stryktips   2. Lotto   3. Maltipset" << endl;  cin>>val1;  system("CLS");       /*********************STRYKTIPS************************/  if(val1 == 1){       cout<<"Hur manga olika rader?"<<endl;       cin>>STrad;            for(int a=0; STrad > a; a++){             cout<<"......."<<endl;             cout<<"|1|X|2|"<<endl;             cout<<"|||||||"<<endl;           for(x=0; x < 13; x++){           STradprint = rand()%3+1;           if(STradprint == 1){           cout<<"|1| | |"<<endl;           }           else if(STradprint == 2){           cout<<"| |X| |"<<endl;           }           else if(STradprint == 3){           cout<<"| | |2|"<<endl;           }  // slut if           } // slut for 1           } //slut for2  }      /***********************SLUT***************************/      /*********************STRYKTIPS************************/        /***********************LOTTO**************************/  else if(val1 == 2){  cout<<"Hur manga lottorader?"<<endl;  cin>>lottorad;   for ( int y = 0; y < lottorad; y++){			resetArray(arr);			for ( int i = 0; i < 7; i++ ) {					do{			  		 cin >> rnumber;			  		 exists = findNumber(rnumber, arr);			  		 if (exists)						   cout<<"Dubblett: "<<rnumber<<" ";					   else					   		 arr[i] = rnumber;					} while (exists);        for(i = 0; i < MAX_LENGHT; i++){        cout<<arr[i]<<" ";       }        }  cout<<endl;  }  cout<<endl;  }      /***********************SLUT***************************/      /***********************LOTTO**************************/        /**********************MALTIPS*************************/  else if(val1 == 3){  cout<<"Antal maltips rader:"<<endl;  cin>>maltipsrader;  }      /***********************SLUT***************************/      /**********************MALTIPS*************************/   cout<<"Kora om?"<<endl;  cout<<"1. Ja    2. Nej"<<endl;  cin>>val2;  system("CLS");   } // slut DO   while(val2 == 1);   system("PAUSE");  return EXIT_SUCCESS;} /**********Funktioner**********************************************************/int resetArray(int arr[]) {		for(int i = 0; i < MAX_LENGHT; i++)						arr[i] = 0;}int findNumber(int num, int arr[]){    for(int i = 0; i < MAX_LENGHT; i++)        if(num == arr[i])            return 1;    return 0;}