No, this is not an assignement. Recently I decided to pick up writing code again and the project I started writing I came to a rode block with something that I never learned in class (I don't think).
How would I be able to write this better (should I stick with the case statements or should I switch to if statements or something completely different?) so that if someone puts in the wrong password it will return them to the beginning to line 13? This is the code I have written so far:
#include <iostream>
#include <time.h>
#include <stdlib.h>
#include <windows.h>
#include <cstdio>
#include <conio.h>
using namespace std;
int main()
{
char cPass;
cout << "Hello user. Please input your password:" << endl;
cin >> cPass;
switch(cPass)
{
case 'correct':
{
cout << "Welcome Walker. What course are we running today?" << endl;
}
/*This is where I run into my question.*/
case
{
system ("cls");
cout << "Invalid password. Please try again." << endl;
return int main;
}
}
return 0;
}
It's been a couple of years since I wrote code so my mind draws a blank. I've looked on some other sites and I can't seem to find an answer to my question. Any help would be spectacular!
-Walker