Display the largest element of an object [on hold]
namespace problema_1
{
class classMaxim
{
public int calculeazaMaxim(int tab)
{
int maxim = tab[0];
for (int i = 1; i <= tab.Length; i++)
{
if (tab[i] > maxim)
maxim = tab[i];
}
return maxim;
}
}
class Program
{
static void Main(string args)
{
int tab = new int[0];
int dimensTablou = 0;
classMaxim obj = new classMaxim[0];
int dimClass = 0;
do
{
Console.Write("Enter the object string {0}: ",dimClass+1);
string sir = Console.ReadLine();
dimensTablou = 0;
for (int i = 0; i < sir.Length; i++)
{
if (char.IsDigit(sir[i]))
{
Array.Resize(ref tab, dimensTablou = dimensTablou + 1);
tab[dimensTablou - 1] = Convert.ToInt32(sir[i].ToString());
}
}
for (int i = 0; i < dimensTablou; i++)
Console.Write("{0}", tab[i]);
Console.Write("nContinue? Press n to exit!");
} while (Console.ReadLine() != "n");
Console.ReadKey();
}
}
What I've done so far:
A character string including alphabetical and numerical characters is read in the Main. I got this class that includes a method which purpose it to calculate and return the maximum of an array including integers only. I calculated the maximum of all integers from the read string. Then, multiple strings are read so that each string corresponds to a new object of the class. For each character string read, the maximum numeric characters for the current string will be calculated.
Now I have to do the following: After entering all character strings, the largest element of the object entered by the user will be displayed.
Please help me.
c#
New contributor
Rebecca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by πάντα ῥεῖ, t3chb0t, Gerrit0, 200_success, Mast yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, t3chb0t, Gerrit0, 200_success, Mast
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
namespace problema_1
{
class classMaxim
{
public int calculeazaMaxim(int tab)
{
int maxim = tab[0];
for (int i = 1; i <= tab.Length; i++)
{
if (tab[i] > maxim)
maxim = tab[i];
}
return maxim;
}
}
class Program
{
static void Main(string args)
{
int tab = new int[0];
int dimensTablou = 0;
classMaxim obj = new classMaxim[0];
int dimClass = 0;
do
{
Console.Write("Enter the object string {0}: ",dimClass+1);
string sir = Console.ReadLine();
dimensTablou = 0;
for (int i = 0; i < sir.Length; i++)
{
if (char.IsDigit(sir[i]))
{
Array.Resize(ref tab, dimensTablou = dimensTablou + 1);
tab[dimensTablou - 1] = Convert.ToInt32(sir[i].ToString());
}
}
for (int i = 0; i < dimensTablou; i++)
Console.Write("{0}", tab[i]);
Console.Write("nContinue? Press n to exit!");
} while (Console.ReadLine() != "n");
Console.ReadKey();
}
}
What I've done so far:
A character string including alphabetical and numerical characters is read in the Main. I got this class that includes a method which purpose it to calculate and return the maximum of an array including integers only. I calculated the maximum of all integers from the read string. Then, multiple strings are read so that each string corresponds to a new object of the class. For each character string read, the maximum numeric characters for the current string will be calculated.
Now I have to do the following: After entering all character strings, the largest element of the object entered by the user will be displayed.
Please help me.
c#
New contributor
Rebecca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by πάντα ῥεῖ, t3chb0t, Gerrit0, 200_success, Mast yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, t3chb0t, Gerrit0, 200_success, Mast
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
namespace problema_1
{
class classMaxim
{
public int calculeazaMaxim(int tab)
{
int maxim = tab[0];
for (int i = 1; i <= tab.Length; i++)
{
if (tab[i] > maxim)
maxim = tab[i];
}
return maxim;
}
}
class Program
{
static void Main(string args)
{
int tab = new int[0];
int dimensTablou = 0;
classMaxim obj = new classMaxim[0];
int dimClass = 0;
do
{
Console.Write("Enter the object string {0}: ",dimClass+1);
string sir = Console.ReadLine();
dimensTablou = 0;
for (int i = 0; i < sir.Length; i++)
{
if (char.IsDigit(sir[i]))
{
Array.Resize(ref tab, dimensTablou = dimensTablou + 1);
tab[dimensTablou - 1] = Convert.ToInt32(sir[i].ToString());
}
}
for (int i = 0; i < dimensTablou; i++)
Console.Write("{0}", tab[i]);
Console.Write("nContinue? Press n to exit!");
} while (Console.ReadLine() != "n");
Console.ReadKey();
}
}
What I've done so far:
A character string including alphabetical and numerical characters is read in the Main. I got this class that includes a method which purpose it to calculate and return the maximum of an array including integers only. I calculated the maximum of all integers from the read string. Then, multiple strings are read so that each string corresponds to a new object of the class. For each character string read, the maximum numeric characters for the current string will be calculated.
Now I have to do the following: After entering all character strings, the largest element of the object entered by the user will be displayed.
Please help me.
c#
New contributor
Rebecca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
namespace problema_1
{
class classMaxim
{
public int calculeazaMaxim(int tab)
{
int maxim = tab[0];
for (int i = 1; i <= tab.Length; i++)
{
if (tab[i] > maxim)
maxim = tab[i];
}
return maxim;
}
}
class Program
{
static void Main(string args)
{
int tab = new int[0];
int dimensTablou = 0;
classMaxim obj = new classMaxim[0];
int dimClass = 0;
do
{
Console.Write("Enter the object string {0}: ",dimClass+1);
string sir = Console.ReadLine();
dimensTablou = 0;
for (int i = 0; i < sir.Length; i++)
{
if (char.IsDigit(sir[i]))
{
Array.Resize(ref tab, dimensTablou = dimensTablou + 1);
tab[dimensTablou - 1] = Convert.ToInt32(sir[i].ToString());
}
}
for (int i = 0; i < dimensTablou; i++)
Console.Write("{0}", tab[i]);
Console.Write("nContinue? Press n to exit!");
} while (Console.ReadLine() != "n");
Console.ReadKey();
}
}
What I've done so far:
A character string including alphabetical and numerical characters is read in the Main. I got this class that includes a method which purpose it to calculate and return the maximum of an array including integers only. I calculated the maximum of all integers from the read string. Then, multiple strings are read so that each string corresponds to a new object of the class. For each character string read, the maximum numeric characters for the current string will be calculated.
Now I have to do the following: After entering all character strings, the largest element of the object entered by the user will be displayed.
Please help me.
c#
c#
New contributor
Rebecca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Rebecca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Rebecca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked yesterday
RebeccaRebecca
1
1
New contributor
Rebecca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Rebecca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Rebecca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by πάντα ῥεῖ, t3chb0t, Gerrit0, 200_success, Mast yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, t3chb0t, Gerrit0, 200_success, Mast
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by πάντα ῥεῖ, t3chb0t, Gerrit0, 200_success, Mast yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, t3chb0t, Gerrit0, 200_success, Mast
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes