Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Everyone!

Please Tell ME About the Error In This Program.I GOT TWO ERROR Please See Below

VB
Error   1   The best overloaded method match for 'Practice_Csharp_2.Program.Mark_info(string[], string[], string[])' has some invalid arguments 


VB
Error   2   Argument 1: cannot convert from 'int[]' to 'string[]'  


IF ANY ONE KNOW PLEASE TELL ME



Cde

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Practice_Csharp_2
{
    enum constant
    {
        subject = 6,
        name = 3,
    }
    class Program
    {
        static void Main(string[] args)
        {
            string[] student = new string[(int)constant.name];
            string[] course = new string[(int)constant.subject];
            int[] Marks = new int[18];
            int x, y;
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WriteLine("\t\t\t-------------------------");
            Console.WriteLine("\t\t\tStudent Managment System.");
            Console.WriteLine("\t\t\t-------------------------");
            Console.ResetColor();
            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.Write("\n\t\t\tEnter Name Of Student.");
            Console.ResetColor();
            Console.Write("\n");
            for (x = 0; x < (int)constant.name; x++)
            {
                Console.Write("\nEnter Student {0} Name:", x + 1);
                student[x] =Convert.ToString(Console.ReadLine());
            }

            //Calling Function For Taking Student Course
            cou(course);
            Console.Write("\nEnter Marks Of Student Subject -Wise.\n");
            //Loop Show Name And Take Their Marks Of Subject.
            for (x = 0; x < (int)constant.name; x++)
            {
                Console.Clear();
                Console.Write("\n\t\t\tEnter {0} Marks.", student[x]);
                for (y = 0; y < (int)constant.subject; y++)
                {
                    Console.WriteLine("\n\n{0}  Marks:", course[y]);
                    Marks[y] = Convert.ToInt32(Console.ReadLine());

                }
            }
            //Pass Marks And Student Name Through Function.<\b>
//1:I Got One Error On Function Of Array Passing
            Mark_info( Marks,  student, course);
            Console.ReadLine();
        }
        //Making New Function For Getting Course Name.
        static string[]  cou(string[] course)
        {
            int x;
            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.Write("\n\t\t\tEnter Subject Name.");
            Console.ResetColor();
            for (x = 0; x < (int)constant.subject; x++)
            {
                Console.Write("\nEnter Subject {0} Name.",x+1);
                course[x] = Convert.ToString(Console.ReadLine());
            }
            Console.Clear();
            return course;
        }
        //2nd Functin Which Show Enter DATA (Student Name& Marks).
        static void Mark_info(string[] Marks, string[] student, string[] course)
        {
            int x, y;
            Console.Write("Student Detail.");
            for (x = 0; x < (int)constant.name; x++)
            {
                Console.Write("\t\t\tStudent {0} Detail.", student[x]);
                Console.Clear();
                for (y = 0; y < (int)constant.subject; y++)
                {
                    Console.Write("{0} Marks:{1}", course[y], Marks[y]);
                }
            }
        }
    }
}
Posted

1 solution

First, you do not need to shout in big, bold letters to get an answer.
Second, both error messages are due to the same cause.
Read the errors messages carefully, the first message is telling you that some of the arguments to Mark_info are invalid. The second message says that the problem is with the first argument; the argument is an array of int which cannot be converted to an array of string. In other words the first argument to Mark_info must be of type string[], but you have passed in Marks which is of type int[].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900