change char to asterisk(*)

Im just new to c++ and we are making a program that changes the text into asterisk (*) like on what we get when logging in on a website. please help! thanks!
Do you have anything written so far?
Here is one way of doing it. Be aware that it might work only with Visual Studio.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#define _CRT_NONSTDC_NO_WARNINGS

#include <iostream>
#include <conio.h>

using namespace std;

const int RETURN = 13;

int main()
{
  int ch = getch();
  while (ch != RETURN)
  {
    cout << "*";
    ch = getch();
  }
  system("pause"); // remove if not using Visual Studio
  return 0;
}
That's a sample:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

bool IsChar(char);


int main()
{
    int size;
    string str;

    cin >> str;

    size = str.length();

    for(int i = 0; i < size; ++i)
    {
        if(IsChar(str[i]))
        {
            str[i] = '*';
        }
    }
    cout << str << endl;


    return 0;
}


bool IsChar(char s)
{
    return (isalpha(tolower(s)));
}
Topic archived. No new replies allowed.