Free c++ tutor

Hi, I've found that some are looking for someone to help them in real time through Skype or something.

I have the 1/3 of a bachelor degree, I have enough knowledge to answer the beginners questions.

I can teach c++ from scratch too.

I'm not doing it that all of kindness, mostly I have too much free time and I want to practice explaining in English, it's my second language but I'm sure I can be understand.

Reply or send me a message for more info.

Mark
Last edited on
Hi can you help me right now?
Yes I can
so im trying to make a password generator
#include <iostream>

using namespace std;

int main()
{
short age;
int brain_wt;
bool glue;
int K= (26*65*32);

cout << "Welcome to the Password Generator!"<<endl;
cout << "Please enter the following information."<<endl;
cout << "What is your age? "<<endl;
cin >> age;
cout << "What is the weight of your brain? "<<endl;
cin >> brain_wt;
cout << "Do you eat glue on a regular basis? "<<endl;
cin >> glue;

int letter1, letter2, letter3, letter4;

letter1= (static_cast<int>((brain_wt/static_cast<float>(age)))*K)%(26+65+32);

letter2= (static_cast<int>((brain_wt/static_cast<float>(age)))*(K+=100))%(26+65+32);

letter3= (static_cast<int>((brain_wt/static_cast<float>(age)))*(K+=100))%(26+65+32);

letter4= (static_cast<int>((brain_wt/static_cast<float>(age)))*(K+=100))%(26+65+32);

static_cast<char>(letter1)<< static_cast<char>(letter2)<< static_cast<char>(letter3);
<< static_cast<char>(letter4);

cout<< "Your password is: "<<letter1<<letter2<<letter3<<letter4<<endl;
cout<< "Have a great day and don't forget your password!"<<endl;

return 0;
}
i need to figure out my mistakes and i cant do anything too complicated its telling me my static_cast<char> 's have no effect. and my goal is to get letter1, 2, 3, and 4 to give me an integer so i can make it into a char.
Last edited on
That's because your syntax for
1
2
static_cast<char>(letter1)<< static_cast<char>(letter2)<< static_cast<char>(letter3);
<< static_cast<char>(letter4);
is syntactically wrong. You're probably trying to do something along the lines of int a,b,c; in which you're trying to do the same operation a number of times on a number of variables.

If you're just starting out, you'll want to think of operators >> and << as input and output, respectively. You'll see more of this on file i/o whenever you cover that.

tl;dr Get rid of the operators<< and separate each static_cast line. It'll work.
There is a function that generate random number, it can be better than asking childish question XD.

Look at this program I made for you, it generates random letters

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//Random numbers

#include <iostream>
#include <ctime> // For the use of random number
using namespace std;

void main (void)
{
char Random_Letter;
int Random_Number; 
int Random_Inferior_Boundary = 65; // ASCII table capital letters start
int Random_Superior_Boundary = 90; // ASCII table capital letters end

srand( (unsigned) time(NULL)); // This set the random function with the computer's clock

Random_Number = (rand() % ((Random_Superior_Boundary + 1) - Random_Inferior_Boundary) + Random_Inferior_Boundary);

Random_Letter = Random_Number;

cout << Random_Letter << endl;

system("pause");

}



otherwise

int letter1, letter2, letter3, letter4;

and should be with

short age;
int brain_wt; // It should be Brain_Weight at least, its better.
bool glue;
int K= (26*65*32);

For good programming practice.

It looks like an disguised homework to do, it's kind of weird.

<< static_cast<char>(letter4);
here your << goes out and I don't understand.

instead of calling the static_cast<char>(letter4) you can do: (char) letter4, only when you need it to be a char

What is that K value?

Tell me if you need more help
Last edited on
Topic archived. No new replies allowed.