Codecheck

This is a discussion on Codecheck within the C++ Programming forums, part of the General Programming Boards category; Basically i am trying to write a program that will let you imput how many cards you want to be ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    1

    Codecheck

    Basically i am trying to write a program that will let you imput how many cards you want to be made, ask you for the word and definition, store then, then quiz you, by first stating the word, then the defination will pop up upon hitting enter. Well this is as far as i have got, i would love some of you expert programmings opinions, even suggestions on what i should reserch to finish this program. Thank you for your time on reviewing this.






    Code:
    #include <iostream>	
    
    		
    using namespace std;
    
    
    int counter
    
    
    int main()                            
    
    {
    
      int totcrd;
      int counter;
      char name[totcrd];
      char defined[totcrd];
      char astring[totcrd];                    //Can i have a array defined by a variable?
                                  
                                                          
      counter = 0                             
    
      cout<<"Starting Vocab Quiz version 1.0 made by Chris Moore!\n";
      cout<<"Welcome to Vocab Quiz 1.0 please press <enter> when ready.\n";
      cin.get();
    
      cout<<"How many words would you like me to quiz you on?";
      cin>>totcard
      cin.ignore();
      
        nxtword:
    
      cout<<"Word:";                                  //Asks userfor word
      cin>> namea;
      cin.ignore();
      cout<<"Definition for "<< namea<<" ?\n";        //Asks user for definition
      cin>> defineda;
    
      if ( totcrd = counter ) {
        goto quiz;                                    //Goes to the quiz portion of the program
       }
       else {
        counter = coutner + 1                         //Adds another number on counter
        goto nxtwrd; 
       }
    
    
    
    
    }

  2. #2
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Not to be rude or anything, but how in the world did that even compile!? You are missing several different semi-colons and declaring that array with the value of totcrd will just initialize it to 0 because totcrd has no value yet. Wait until totcrd has a value, after the user inputs how many words, to initialize that array. Also you spelled your variables wrong so the compiler won't know what you are talking about. The variable names need to be spelled the way you initialized them. I do not have enough time to find all the other errors right now.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  3. #3
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Here is a working Vocab Quiz program I wrote to maybe help you in your learning, didn't have time to comment the code but it's pretty basic and easy to understand. Attached:
    Attached Files Attached Files
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21