+ 2

Cómo se puede sumar los puntos y nombres de bailarines que te da la máquina?

Ejercicio 57 de C#

8th Apr 2021, 1:43 PM
Leonardo Rodríguez
Leonardo Rodríguez - avatar
3 Réponses
+ 2
Espero que mi código te sirva using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string name1 = Console.ReadLine(); int points1 = Convert.ToInt32(Console.ReadLine()); string name2 = Console.ReadLine(); int points2 = Convert.ToInt32(Console.ReadLine()); DancerPoints dancer1 = new DancerPoints(name1, points1); DancerPoints dancer2 = new DancerPoints(name2, points2); DancerPoints total = dancer1 + dancer2; Console.WriteLine(total.name); Console.WriteLine(total.points); } } class DancerPoints { public string name; public int points; public DancerPoints(string name, int points) { this.name = name; this.points = points; } //sobrecarga el operador + public static Dancer
10th Apr 2021, 2:51 PM
Luis Andrés Valido Fajardo 🇨🇺
Luis Andrés Valido Fajardo 🇨🇺 - avatar
0
Hola tengo este código. using System; using System.Collections.Generic; namespace SoloLearn { class Program { static void Main(string[] args) { int levels = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(Points(levels)); } static int Points(int levels) { //your code goes here int total = (levels + 1) * levels / 2; return total; } } }
21st Apr 2021, 1:30 AM
Jose Reinaldo Parra Morales
Jose Reinaldo Parra Morales - avatar
0
Gracias por responder.
25th Apr 2021, 1:40 PM
Leonardo Rodríguez
Leonardo Rodríguez - avatar