Can you guys help me to convert this C++ to C
https://padlet.com/aimannafis12333/el9ytegudkw69o8e

Schol-R-LEA commented: If you are going to post code, do it in the message, not through a link. +15

What stops you from doing this. Be specific. If you need to have it done for you, consider Upwork, etc.

For those of you who didn't want to click the link, here is the code in the padlet:

#include <iostream>
using namespace std;

void WardCharge(char, int, int);

int main()
{
    char categ;
    int ward_class, days;

    cout << "WELCOME TO HTAA SYSTEM\n\n";

    while(true)
    {
        cout << "Category (G-government, N-non government): ";
        cin  >> categ;
        if (categ == 'G' || categ == 'N')
        {
            while(true)
            {
                cout << "Ward Class: ";
                cin >> ward_class;
                if (ward_class == 1  ward_class == 2  ward_class == 3)
                {
                    cout << "No. of days: ";
                    cin >> days;
                    break;
                }
                else
                {
                    cout << "INVALID\n";
                }
            }
        }
        else
        {
        cout << "INVALID\n";
        }
        break;
        WardCharge(categ, ward_class, days);
    }



    return 0;
}

void WardCharge(char x, int y, int z)
{
    char input_categ;
    int ward_rates, input_class, input_days;

    if (input_categ == 'G' && input_class == 1)
    {
        ward_rates = 80 * input_days;
        cout << "The ward charge is RM" << ward_rates;
    }
    else if (input_categ == 'G' && input_class == 2)
    {
        ward_rates = 65 * input_days;
        cout << "The ward charge is RM" << ward_rates;
    }
    else if (input_categ == 'G' && input_class == 3)
    {
        ward_rates = 40 * input_days;
        cout << "The ward charge is RM" << ward_rates;
    }

    return;
}

However, for as simple as this code is, it seems as simple as changing cout into printf() and cin into fgets().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.