Please help me with converting C# class to C [closed]

  c++

I created this code in C#. But due to some project work I’m trying to convert it to C. As I am already C programing doesn’t fall into OOP concept. it is now quite difficult for me to convert these classes into struct. Please help me with converting C# class to C.

        using System;

        class Program
        {
            static void Main(string[] args)
            {

                // Declaration 
                float daily, total_daily = 0, total_averge = 0;
                float highest = 0;
                int average = 0;
                int final_count = 0;

                string rootFile = @"D:External Work18-January-Averages-AGLHAL.txt";

                //File array stirng format 
                var LIST = ReadThefile(rootFile);

                // Looping into the file 
                for (int i = 0; i < LIST.Length; i++)
                {
                    daily = float.Parse(LIST[i]);
                    highest = GetHighestDaily(daily, highest);

                    average = GetArvageDaily(daily, average);


                    total_daily = total_daily + daily;

                }

                total_averge = GetTotalAvergaofDaily(total_daily, average);

                final_count = GetFinalOutput(final_count, total_averge, LIST);



                // Ouput result 

                Console.WriteLine(" Summary Information for AGLHAL");
                Console.WriteLine(" File Name : 2018-January-Averages-AGLHAL.txt");

                if (highest == 0.00 && average == 0)
                {
                    Console.WriteLine("Max :" + highest.ToString("0.#"));
                    Console.WriteLine("Total Araveage :" + average);
                }

                else
                {
                    Console.WriteLine("Max :" + highest.ToString("0.#"));
                    Console.WriteLine("Total Araveage :" + average);
                    Console.WriteLine("Total avrge :" + total_averge);
                    Console.WriteLine("average :" + final_count);
                }

                Console.ReadLine();

            }

            private static int GetFinalOutput(int final_count, float total_averge, string[] lIST)
            {
                for (int i = 0; i < lIST.Length; i++)
                {
                    if (float.Parse(lIST[i]) > total_averge)
                    {
                        final_count++;
                    }
                }

                return final_count;
            }

            private static float GetTotalAvergaofDaily(float total_daily, int average)
            {
                return total_daily / average;
            }

            private static int GetArvageDaily(float daily, int average)
            {
                if (daily > 0.00)
                {
                    average++;
                }

                return average;

            }

            private static float GetHighestDaily(float daily, float highest)
            {
                return daily > highest ? daily : highest;
            }

            private static string[] ReadThefile(string rootFile)
            {
                string[] dir = File.ReadAllLines(rootFile);
                return dir;
            }
        }

I created this code in C#. But due to some project work I’m trying to convert it to C. As I am already C programing doesn’t fall into OOP concept. it is now quite difficult for me to convert these classes into struct. Please help me with converting C# class to C.

Source: Windows Questions C++

LEAVE A COMMENT