Dev - C++ - utiliza el do while

 
Vista:

utiliza el do while

Publicado por juan (3 intervenciones) el 22/10/2020 07:42:44
necesito realizar este programa con el do while y quitar el for

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
#include <stdlib.h>
#include <iostream>
using namespace std;
int matriz [2][3];
int valor, i, j, sum;
mail()
{
	cout<<"PROGRAM  THAT SHOW AN ARRAY 5X5\n\n"<<endl;
	system("color B0");
	for(i=0;i<3;i++)
	{
		for(j=0; j<4;j++)
		{
			cout<<"insert the value of tha array in the position["<<i<<","<<j<<"]:";
			cin>>valor;
			matriz[i][j] = valor;
		}
	}
	    for(i=0;i<3;i++)
	    {
	    	cout<<"|";
	    	for(j=0; j<4;j++)
	    	{
	    		cout<<"\t"<<matriz [i][j]<<"\t";
			}
			cout<<"|"<<endl;
		}
	system("PAUSE");
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Alfil
Val: 4.344
Oro
Ha mantenido su posición en Dev - C++ (en relación al último mes)
Gráfica de Dev - C++

utiliza el do while

Publicado por Alfil (1444 intervenciones) el 23/10/2020 09:11:04
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
#include <iostream>
#include <cstdlib>
 
using namespace std;
 
const int fil = 5;
const int col = 5;
 
int main()
{
    int matriz[fil][col];
 
    cout << "\nPROGRAM THAT SHOW AN ARRAY 5X5\n\n" << endl;
 
    system("color B0");
 
    int i = 0, j = 0;
    while (i < fil)
    {
        while (j < col)
		{
			cout << "Insert the value of tha array in the position[" << i << "," << j << "]: ";
			cin >> matriz[i][j];
			j++;
		}
		j = 0;
		i++;
	}
 
	cout << endl << endl;
	i = j = 0;
    while (i < fil)
    {
        cout << "|";
        while (j < col)
        {
            cout << "\t" << matriz[i][j] << "\t";
            j++;
        }
        cout << "|" << endl;
        j = 0;
        i++;
    }
 
    cout << endl;
	system("PAUSE");
 
	return 0;
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar