Help with a customer id program

I need a program to run that will accept an input for user id. It will take the customer input and capitalize the letters, and return invalid id with the user inputted values. Then if it's valid it will add a counter counting the number of letters and numbers. It will keep track until the user puts in !. I am also new to this forum so I haven't a clue how to put in my code. Any help on the array passing would help. It seems when I try to pass values from the array to my toUpper function to capitalize it it doesn't seem to work right.
closed account (Dy7SLyTq)
what do you have so far? paste your code in code tags, which is the <> button under the format section. if you hover over it then it will say source code
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <iomanip>
#include <iostream>
using namespace std;
char ch, array1, array2, array3, array4, array5, array6, array7;
int alphacount = 0, numcount = 0, tmpnum = 0, tmpLet = 0, tstA, tstB, tstC, tstD, tstE, tstF, tstG, input = 7, totalnum = 0, totallet = 0;
int isDigit(char);
int isUpper(char);
char convToUpper(char);
int main()
{char ui[7];
cout << "Enter user id in format ABC1234: " << endl ;
for (int i = 0; i <= input; i++)
	{ui[7] = cin.get();
	
	
	while (ui[0] != '!')
	{
		while (ui[0] != 10)
		{
			tstA = isDigit(ui[i]);
			tstB = isUpper(ui[i]);
			if (tstA == 1 )
			{
				tmpnum++;
			}
			else if (tstB == 1 )
			{
			tmpLet++;
			}
			else
			{
				ui[i] == convToUpper(ui[i]);
				tmpLet++;
			}
			
			if (tmpLet == 4 && tmpnum == 3)
			{
				cout << ui << "Valid Id" << endl;
				totallet += 3;
				totalnum += 4;
				
				
			}
			else if (tmpLet !=4 && tmpnum != 3)
			{
				cout << ui << " Invalid id" << endl;
			}
			cout << "Enter another customer id in the format AAA1234 " << endl;
			for(int i = 0; i <= input; i++)
		{
			ui[i] = cin.get();
			tmpLet == 0;
			tmpnum == 0;
		}
		}
		
}
cout << "Total number of characters: "  <<setw(8) << totallet + totalnum;
cout << endl << endl << "Alphabetic: " << setw(24) << totallet << endl;
cout << "Numerical: " << setw(25) << totalnum;
	return 0;
}
}
char convToUpper(char d)
{
	if(d >= 97 && d <= 122)
	{return ( d - 32);
	}
	else
	return d;

}
int isUpper(char x)
{
	
	if( x >= 65 && x <= 90)
	return 1;
	else
	return 0;
}
int isDigit(char x )
{
	
	if( x >= 48 && x <= 57)
	return 1;
	else
	return 0;
}
Anyone?
Topic archived. No new replies allowed.