HELP with multiplication tables

I'm having trouble getting the outputs of the multiples to work for a while loop multiplication table and a do while loop multiplication table! I need a hint of some sort on why its not working and how i can go about fixing it!
Thanks!



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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;

void main ()
	{
	int r = 0;
	int c = 0;
	int e = 1;
	int d = 1;
	

	cout << "How many columns do you want in your multiplication table? "; 
	cin >> c;
	cout << endl;
	cout << "How many rows do you want in your multiplication table? ";
	cin >> r;
	cout << endl;

	cout << "** FOR LOOP **" <<endl <<endl <<endl;
	
	
	for(int d = 1; d <= c; d++)
          {
		  cout << '\t' << d;
          }

	cout << endl << endl;
	
	for(int e = 1; e <= r; e++)
     {	 	
		 cout <<e;
       	 for(int d = 1; d <= c; d++)
          {
		  cout <<'\t' << d * e;
          }
          cout << endl;
     }


	cout << endl << endl;

	
	cout << "** WHILE LOOP **" <<endl <<endl <<endl;

	while (d <= c)
	{
		cout << '\t' << d;
		d++;
	} 
	cout <<endl;
	cout << endl;

	

		while (e <= r)
			{
			cout << e;
			while (d <= c)
			{
			cout << '\t' << d * e;
			d++;
			}
			e++;
			cout << endl;
			}
	

	e = 1;
	d = 1;

	cout << "** DO LOOP **" <<endl <<endl <<endl;

	do 
	{
		cout << '\t' << d;
		d++;
	} while (d <= c);
	cout <<endl;
	cout << endl;

	d=1;

		do 
		{
		cout << e;
			do
			{
			cout << '\t' << d * e;
			d++;
			}while (d <= r);
		e++;
		cout << endl;
		}while (e < c);

	
	cout <<endl <<endl;
	system("pause");
}
	

Last edited on
nevermind!! got it!!!
Topic archived. No new replies allowed.