456 Posted Topics

Member Avatar for zahidhcy
Re: loop

Nesting a loop inside another loop is very common. Suppose you have a matrix of integers. Suppose the matrix has 3 rows and 4 integers in each row ... Now if you wanted to print out that matrix, a common C, simple way, would be to code like this:

Member Avatar for Unimportant
0
192
Member Avatar for Lp_baez

Mary ... Well learning how to write to file and read back from file, is a basic thing to learn, the OP does not seem to be using any file operations here :) Note: a lot of the time, rather then using an if ... elseif ... else structure or …

Member Avatar for David W
0
383
Member Avatar for Lp_baez

Here is a shell that shows one popular student way to start a menu / choice / switch type program. Note the use of functions to facilitate your logic flow and code developement testing steps. Note the use of getline for input so that the WHOLE line is input. #include …

Member Avatar for David W
0
2K
Member Avatar for pars99
Member Avatar for waqas.zafar.125

Yoo might like to see a C++ way of coding ... Then, if really need dynamic C strings and a dynamic array, you will have a working proto-type to start. #include <iostream> #include <string> #include <vector> //using namespace std; class Player { std::string name; int id; public: // default and …

Member Avatar for David W
0
209
Member Avatar for vishalonne

The End.