-
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;
}
}
-
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.
-
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: