askmewhy25's Avatar, Join Date: Jan 2010
Go4Expert Member
This is the shortest way that I know to make a random without repeating, the purpose of the GetNextNumber is for the flashcard but I replaced it with a new name with Card which represents the flashcards and the Side is for the sides of the flashcard. Now the problem is the repeating of the Side because it only prints for two flashcards after that it does not work anymore

Here is my updated code:

Code:
#include<stdio.h>  
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int Card(){
  static int list[9];
  static int size=-1;
  if(size==-1){
    size=9;
    for(int i=0;i<size;i++){ 
      list[i]=i+1;
      }
    }
  if(size==0){
    return 0;
    }
  int index=rand()%size;
  int num=list[index];
  size--;
  list[index] = list[size];
  return num;
}

int Side(){
  static int list[2];
  static int size=-1;
  if(size==-1){
    size=2;
    for(int i=0;i<size;i++){ 
      list[i]=i+1;
      }
    }
  if(size==0){
    return 0;
    }
  int index=rand()%size;
  int num=list[index];
  size--;
  list[index] = list[size];
  return num;
}

int main(){
  const time_t timer=time(NULL);
  printf("%s\n",ctime(&timer));
  
  srand( time(NULL));
  int x,y;
  for(int i=0;i<9;i++){
    x=Card();
    switch(x){
      case 1:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 2:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 3:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 4:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 5:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 6:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 7:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 8:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 9:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      }
    }
  getche();
}
askmewhy25's Avatar, Join Date: Jan 2010
Go4Expert Member
This is the shortest way that I know to make a random without repeating, the purpose of the GetNextNumber is for the flashcard but I replaced it with a new name with Card which represents the flashcards and the Side is for the sides of the flashcard. Now the problem is the repeating of the Side because it only prints for two flashcards after that it does not work anymore

Here is my updated code:

Code:
#include<stdio.h>  
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int Card(){
  static int list[9];
  static int size=-1;
  if(size==-1){
    size=9;
    for(int i=0;i<size;i++){ 
      list[i]=i+1;
      }
    }
  if(size==0){
    return 0;
    }
  int index=rand()%size;
  int num=list[index];
  size--;
  list[index] = list[size];
  return num;
}

int Side(){
  static int list[2];
  static int size=-1;
  if(size==-1){
    size=2;
    for(int i=0;i<size;i++){ 
      list[i]=i+1;
      }
    }
  if(size==0){
    return 0;
    }
  int index=rand()%size;
  int num=list[index];
  size--;
  list[index] = list[size];
  return num;
}

int main(){
  const time_t timer=time(NULL);
  printf("%s\n",ctime(&timer));
  
  srand( time(NULL));
  int x,y;
  for(int i=0;i<9;i++){
    x=Card();
    switch(x){
      case 1:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 2:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 3:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 4:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 5:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 6:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 7:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 8:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 9:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      }
    }
  getche();
}
askmewhy25's Avatar, Join Date: Jan 2010
Go4Expert Member
This is the shortest way that I know to make a random without repeating, the purpose of the GetNextNumber is for the flashcard but I replaced it with a new name with Card which represents the flashcards and the Side is for the sides of the flashcard. Now the problem is the repeating of the Side because it only prints for two flashcards after that it does not work anymore

Here is my updated code:

Code:
#include<stdio.h>  
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int Card(){
  static int list[9];
  static int size=-1;
  if(size==-1){
    size=9;
    for(int i=0;i<size;i++){ 
      list[i]=i+1;
      }
    }
  if(size==0){
    return 0;
    }
  int index=rand()%size;
  int num=list[index];
  size--;
  list[index] = list[size];
  return num;
}

int Side(){
  static int list[2];
  static int size=-1;
  if(size==-1){
    size=2;
    for(int i=0;i<size;i++){ 
      list[i]=i+1;
      }
    }
  if(size==0){
    return 0;
    }
  int index=rand()%size;
  int num=list[index];
  size--;
  list[index] = list[size];
  return num;
}

int main(){
  const time_t timer=time(NULL);
  printf("%s\n",ctime(&timer));
  
  srand( time(NULL));
  int x,y;
  for(int i=0;i<9;i++){
    x=Card();
    switch(x){
      case 1:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 2:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 3:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 4:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 5:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 6:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 7:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 8:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      case 9:
        printf("Passage Number: %d\n",x);
        for(int j=0;j<2;j++){
          y=Side();
          switch(y){
            case 1:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            case 2:
              printf("Passage Number: %d\n",y);
              getche();
              break;
            }
          }
        getche();
        break;
      }
    }
  getche();
}
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Could you explain what you think Side() is doing and how it fits into the algorithm for the rest of the program? (I can see what Side() *is* doing, but I can't see what you *think* it's doing)
askmewhy25's Avatar, Join Date: Jan 2010
Go4Expert Member
What I think Side() is doing is that the printing of the second side of the flashcard, my problem now is that Side() only works for two times and it does not reset.

Here is the update codes:
Code:
#include <stdio.h>  
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int Card(){
  static int list[9];
  static int size=-1;
  if(size==-1){
    size=9;
    for(int i=0;i<size;i++){ 
      list[i]=i+1;
      }
    }
  if(size==0){
    return 0;
    }
  int index=rand()%size;
  int num=list[index];
  size--;
  list[index]=list[size];
  return num;
}

int Side(){
  static int list[2];
  static int size=-1;
  if(size==-1){
    size=2;
    for(int i=0;i<size;i++){ 
      list[i]=i+1;
      }
    }
  if(size==0){
    return 0;
    }
  int index=rand()%size;
  int num=list[index];
  size--;
  list[index]=list[size];
  return num;
}

int main(){
  const time_t timer=time(NULL);
  printf("%s\n",ctime(&timer));
  
  srand(time(NULL));
  int x,y;
  for(int i=0;i<9;i++){
    x=Card();
    switch(x){
      case 1:
        system("cls");
        printf("Passage Number: %d\n\n",x);
        y=Side();
        switch(y){
          case 1:
            printf("2 Timothy 3:16-17\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("[16] All Scripture is God-breathed and is useful\n");
            printf("for teaching, rebuking, correcting and training\n");
            printf("in righteousness, [17] so that the man of God may be\n");
            printf("thoroughly equipped for every good work.\n\n");
            getche();              
            break;
          case 2:
            printf("[16] All Scripture is God-breathed and is useful\n");
            printf("for teaching, rebuking, correcting and training\n");
            printf("in righteousness, [17] so that the man of God may be\n");
            printf("thoroughly equipped for every good work.\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("2 Timothy 3:16-17\n\n");
            getche();
            break;
          }
        getche();
        break;
      case 2:
        system("cls");
        printf("Passage Number: %d\n\n",x);
        y=Side();
        switch(y){
          case 1:
            printf("Psalm 119:10-11\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");           
            printf("[10] I seek you with all my heart do not let me\n");
            printf("stray from your commands.[11] I have hidden your\n");
            printf("word in my heartthat I might not sin against you.\n\n");
            getche();
            break;
          case 2:
            printf("[10] I seek you with all my heart do not let me\n");
            printf("stray from your commands.[11] I have hidden your\n");
            printf("word in my heartthat I might not sin against you.\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");           
            printf("Psalm 119:10-11\n\n");
            getche();
            break;
          }
        getche();
        break;
      case 3:
        system("cls");
        printf("Passage Number: %d\n\n",x);
        y=Side();
        switch(y){
          case 1:
            printf("Hebrews 12:14\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls"); 
            printf("[14] Make every effort to live in peace with all men and\n");
            printf("to be holy without holiness no one will see the Lord.\n\n");
            getche();
            break;
          case 2:
            printf("[14] Make every effort to live in peace with all men and\n");
            printf("to be holy without holiness no one will see the Lord.\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("Hebrews 12:14\n\n");
            getche();            
            break;
          }
        getche();
        break;
      case 4:
        system("cls");
        printf("Passage Number: %d\n\n",x);
        y=Side();
        switch(y){
          case 1:
            printf("Romans 3:23\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("[23] for all have sinned and fall short of the glory of God,\n\n");
            getche();
            break;
          case 2:
            printf("[23] for all have sinned and fall short of the glory of God,\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("Romans 3:23\n\n");
            getche();
            break;
          }
        getche();
        break;
      case 5:
        system("cls");
        printf("Passage Number: %d\n\n",x);
        y=Side();
        switch(y){
          case 1:
            printf("Galatians 2:16\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("[16] know that a man is not justified by observing the law,\n");
            printf("but by faith in Jesus Christ. So we, too, have put our\n");
            printf("faith in Christ Jesus that we may be justified by faith\n");
            printf("in Christ and not by observing the law, because by observing\n");
            printf("the law no one will be justified.\n\n");
            getche();
            break;
          case 2:
            printf("[16] know that a man is not justified by observing the law,\n");
            printf("but by faith in Jesus Christ. So we, too, have put our\n");
            printf("faith in Christ Jesus that we may be justified by faith\n");
            printf("in Christ and not by observing the law, because by observing\n");
            printf("the law no one will be justified.\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("Galatians 2:16\n\n");
            getche();
            break;
          }
        getche();
        break;
      case 6:
        system("cls");
        printf("Passage Number: %d\n\n",x);
        y=Side();
        switch(y){
          case 1:
            printf("Ephesians 2:8-10\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("[8] For it is by grace you have been saved, through faith—and\n");
            printf("this not from yourselves, it is the gift of God — [9] not by\n");
            printf("works, so that no one can boast. [10] For we are God's\n");
            printf("workmanship, created in Christ Jesus to do good works,\n");
            printf("which God prepared in advance for us to do.\n\n");
            getche();
            break;
          case 2:
            printf("[8] For it is by grace you have been saved, through faith—and\n");
            printf("this not from yourselves, it is the gift of God — [9] not by\n");
            printf("works, so that no one can boast. [10] For we are God's\n");
            printf("workmanship, created in Christ Jesus to do good works,\n");
            printf("which God prepared in advance for us to do.\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("Ephesians 2:8-10\n\n");
            getche();
            break;
          }
        getche();
        break;
      case 7:
        system("cls");
        printf("Passage Number: %d\n\n",x);
        y=Side();
        switch(y){
          case 1:
            printf("1 Peter 2:9\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("[9] But you are a chosen people, a royal priesthood, a holy\n");
            printf("nation, a people belonging to God, that you may declare\n");
            printf("the praises of him who called you out of darkness into his\n");
            printf("wonderful light.\n\n");
            getche();
            break;
          case 2:
            printf("[9] But you are a chosen people, a royal priesthood, a holy\n");
            printf("nation, a people belonging to God, that you may declare\n");
            printf("the praises of him who called you out of darkness into his\n");
            printf("wonderful light.\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("1 Peter 2:9\n\n");
            getche();
            break;
          }
        getche();
        break;
      case 8:
        system("cls");
        printf("Passage Number: %d\n\n",x);
        y=Side();
        switch(y){
          case 1:
            printf("Romans 3:22-24\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("[22] This righteousness from God comes through faith in\n");
            printf("Jesus Christ to all who believe. There is no difference,\n");
            printf("[23] for all have sinned and fall short of the glory of God,\n");
            printf("[24] and are justified freely by his grace through the\n");
            printf("redemption that came by Christ Jesus.\n\n");
            getche();
            break;
          case 2:
            printf("[22] This righteousness from God comes through faith in\n");
            printf("Jesus Christ to all who believe. There is no difference,\n");
            printf("[23] for all have sinned and fall short of the glory of God,\n");
            printf("[24] and are justified freely by his grace through the\n");
            printf("redemption that came by Christ Jesus.\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("Romans 3:22-24\n\n");
            getche();
            break;
          }
        getche();
        break;
      case 9:
        system("cls");
        printf("Passage Number: %d\n\n",x);
        y=Side();
        switch(y){
          case 1:
            printf("John 3:16\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("[16] For God so loved the world that he gave his one and\n");
            printf("only Son, that whoever believes in him shall not perish\n");
            printf("but have eternal life.\n\n");
            getche();
            break;
          case 2:
            printf("[16] For God so loved the world that he gave his one and\n");
            printf("only Son, that whoever believes in him shall not perish\n");
            printf("but have eternal life.\n\n");
            printf("Please press the spacebar to continue!!");
            getche();
            system("cls");
            printf("John 3:16\n\n");
            getche();
            break;
          }
        getche();
        break;
      }
    }
  getche();
}
askmewhy25's Avatar, Join Date: Jan 2010
Go4Expert Member
Sir now I figured out the problem with the Side() I change it, here is may last problem

*If correct, the user promotes the flashcard to box A. If incorrect, the user promotes the flashcard to box C.
If the user is unsure or almost close to the correct one, the user promotes the flashcard to box B. The promotion is based on honest user input

*After the user goes through all the flashcards, the program gives the user's score and stores it with its corresponding date and time.


Here is my updated codes:
Code:
#include <stdio.h>  
#include <conio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

typedef struct Box{
  int A;
  int B;
  int C;
}Box;

void Ans(int sel,Box z);

int Card(){
  static int list[9];
  static int size=-1;
  if (size==-1){
    size=9;
    for(int i=0;i<size;i++){ 
      list[i]=i+1;
      }
    }
  if(size==0){
    return 0;
    }
  int index=rand()%size;
  int num=list[index];
  size--;
  list[index]=list[size];
  return num;
}


int Side(){
  int num;
  srand(time(NULL));
  num=1+(rand()%2);
  return num;
}

int main(){
  Box z;
  int x,y,sel;
  char error[128];
  const time_t timer=time(NULL);
  
  do{
      system("cls");
      printf("%s\n",ctime(&timer));
      printf("Selection Screen\n\n");
      printf("Flashcard Game\n");
      printf("1 - Play the Flashcard Game\n");
      printf("2 - Redo the Flashcards inside Box B and C\n\n");
      printf("Box Operation\n");
      printf("3 - Empty All the Boxes\n");
      printf("4 - Empty Box A\n");
      printf("5 - Empty Box B\n");
      printf("6 - Empty Box C\n\n");
      printf("Display All the Scores\n");
      printf("7 - Display All the Scores\n");
      printf("8 - Exit\n");
      fgets(error,128,stdin);
      sel=atoi(error);
      
      switch(sel){
        case 1:
          srand(time(NULL));
          for(int i=0;i<9;i++){
            x=Card();
            switch(x){
              case 1:
                system("cls");
                printf("Passage Number: %d\n\n",x);
                y=Side();
                switch(y){
                  case 1:
                    printf("2 Timothy 3:16-17\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("[16] All Scripture is God-breathed and is useful\n");
                    printf("for teaching, rebuking, correcting and training\n");
                    printf("in righteousness, [17] so that the man of God may be\n");
                    printf("thoroughly equipped for every good work.\n\n");
                    getche();       
                    break;
                  case 2:
                    printf("[16] All Scripture is God-breathed and is useful\n");
                    printf("for teaching, rebuking, correcting and training\n");
                    printf("in righteousness, [17] so that the man of God may be\n");
                    printf("thoroughly equipped for every good work.\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("2 Timothy 3:16-17\n\n");
                    getche();
                    break;
                  }
                break;
              case 2:
                system("cls");
                printf("Passage Number: %d\n\n",x);
                y=Side();
                switch(y){
                  case 1:
                    printf("Psalm 119:10-11\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");           
                    printf("[10] I seek you with all my heart do not let me\n");
                    printf("stray from your commands.[11] I have hidden your\n");
                    printf("word in my heartthat I might not sin against you.\n\n");
                    getche();
                    break;
                  case 2:
                    printf("[10] I seek you with all my heart do not let me\n");
                    printf("stray from your commands.[11] I have hidden your\n");
                    printf("word in my heartthat I might not sin against you.\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");           
                    printf("Psalm 119:10-11\n\n");
                    getche();
                    break;
                  }
                break;
              case 3:
                system("cls");
                printf("Passage Number: %d\n\n",x);
                y=Side();
                switch(y){
                  case 1:
                    printf("Hebrews 12:14\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls"); 
                    printf("[14] Make every effort to live in peace with all men and\n");
                    printf("to be holy without holiness no one will see the Lord.\n\n");
                    getche();
                    break;
                  case 2:
                    printf("[14] Make every effort to live in peace with all men and\n");
                    printf("to be holy without holiness no one will see the Lord.\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("Hebrews 12:14\n\n");
                    getche();            
                    break;
                  }
                break;
              case 4:
                system("cls");
                printf("Passage Number: %d\n\n",x);
                y=Side();
                switch(y){
                  case 1:
                    printf("Romans 3:23\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("[23] for all have sinned and fall short of the glory of God,\n\n");
                    getche();
                    break;
                  case 2:
                    printf("[23] for all have sinned and fall short of the glory of God,\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("Romans 3:23\n\n");
                    getche();
                    break;
                  }
                break;
              case 5:
                system("cls");
                printf("Passage Number: %d\n\n",x);
                y=Side();
                switch(y){
                  case 1:
                    printf("Galatians 2:16\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("[16] know that a man is not justified by observing the law,\n");
                    printf("but by faith in Jesus Christ. So we, too, have put our\n");
                    printf("faith in Christ Jesus that we may be justified by faith\n");
                    printf("in Christ and not by observing the law, because by observing\n");
                    printf("the law no one will be justified.\n\n");
                    getche();
                    break;
                  case 2:
                    printf("[16] know that a man is not justified by observing the law,\n");
                    printf("but by faith in Jesus Christ. So we, too, have put our\n");
                    printf("faith in Christ Jesus that we may be justified by faith\n");
                    printf("in Christ and not by observing the law, because by observing\n");
                    printf("the law no one will be justified.\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("Galatians 2:16\n\n");
                    getche();
                    break;
                  }
                break;
              case 6:
                system("cls");
                printf("Passage Number: %d\n\n",x);
                y=Side();
                switch(y){
                  case 1:
                    printf("Ephesians 2:8-10\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("[8] For it is by grace you have been saved, through faith—and\n");
                    printf("this not from yourselves, it is the gift of God — [9] not by\n");
                    printf("works, so that no one can boast. [10] For we are God's\n");
                    printf("workmanship, created in Christ Jesus to do good works,\n");
                    printf("which God prepared in advance for us to do.\n\n");
                    getche();
                    break;
                  case 2:
                    printf("[8] For it is by grace you have been saved, through faith—and\n");
                    printf("this not from yourselves, it is the gift of God — [9] not by\n");
                    printf("works, so that no one can boast. [10] For we are God's\n");
                    printf("workmanship, created in Christ Jesus to do good works,\n");
                    printf("which God prepared in advance for us to do.\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("Ephesians 2:8-10\n\n");
                    getche();
                    break;
                  }
                break;
              case 7:
                system("cls");
                printf("Passage Number: %d\n\n",x);
                y=Side();
                switch(y){
                  case 1:
                    printf("1 Peter 2:9\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("[9] But you are a chosen people, a royal priesthood, a holy\n");
                    printf("nation, a people belonging to God, that you may declare\n");
                    printf("the praises of him who called you out of darkness into his\n");
                    printf("wonderful light.\n\n");
                    getche();
                    break;
                  case 2:
                    printf("[9] But you are a chosen people, a royal priesthood, a holy\n");
                    printf("nation, a people belonging to God, that you may declare\n");
                    printf("the praises of him who called you out of darkness into his\n");
                    printf("wonderful light.\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("1 Peter 2:9\n\n");
                    getche();
                    break;
                  }
                break;
              case 8:
                system("cls");
                printf("Passage Number: %d\n\n",x);
                y=Side();
                switch(y){
                  case 1:
                    printf("Romans 3:22-24\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("[22] This righteousness from God comes through faith in\n");
                    printf("Jesus Christ to all who believe. There is no difference,\n");
                    printf("[23] for all have sinned and fall short of the glory of God,\n");
                    printf("[24] and are justified freely by his grace through the\n");
                    printf("redemption that came by Christ Jesus.\n\n");
                    getche();
                    break;
                  case 2:
                    printf("[22] This righteousness from God comes through faith in\n");
                    printf("Jesus Christ to all who believe. There is no difference,\n");
                    printf("[23] for all have sinned and fall short of the glory of God,\n");
                    printf("[24] and are justified freely by his grace through the\n");
                    printf("redemption that came by Christ Jesus.\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("Romans 3:22-24\n\n");
                    getche();
                    break;
                  }
                break;
              case 9:
                system("cls");
                printf("Passage Number: %d\n\n",x);
                y=Side();
                switch(y){
                  case 1:
                    printf("John 3:16\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("[16] For God so loved the world that he gave his one and\n");
                    printf("only Son, that whoever believes in him shall not perish\n");
                    printf("but have eternal life.\n\n");
                    getche();
                    break;
                  case 2:
                    printf("[16] For God so loved the world that he gave his one and\n");
                    printf("only Son, that whoever believes in him shall not perish\n");
                    printf("but have eternal life.\n\n");
                    printf("Please press the spacebar to continue!!");
                    getche();
                    system("cls");
                    printf("John 3:16\n\n");
                    getche();
                    break;
                  }
                break;
              }
            }
          system("cls");
          printf("Your score is %d: ",z.A);
          break;
        case 2:
          break;
        case 3:
          break;
        case 4:
          break;
        case 5:
          break;
        case 6:
          break;
        case 7:
          break;
        case 8://Exit
          exit(1);
          break;
        default://Program redirects the invalid input
          system("cls");
          printf("Invalid input. Please try again!!!\n");
          printf("Please press the spacebar to continue!!");
          getche();
          break;
        }
  
  }while(sel!=8);
}

void Ans(int sel,Box z){
  char error[128];
  printf("Which box do you want to promote the flashcard?\n\n");
  printf("1 - Box A for Correct Answer");
  printf("2 - Box B for Unsure Answer");
  printf("3 - Box C for Invalid Answer");
  scanf("%s",&error);
  sel=atoi(error);
  switch(sel){
    case 1:
      z.A=z.A+1;
      break;
    case 2:
      z.B=z.B+1;
      break;
    case 3:
      z.C=z.C+1;
      break;
    }
}

Last edited by askmewhy25; 21Mar2010 at 00:45..