What's new

C & C++ Pahelp naman po kung anong mali jan

Jirachi2016

Eternal Poster
Established
#include <iostream>
using namespace std;

struct customer
{
int cstmrnmber;
char name[50];
int age;
char address[50];
double contactno;
double temp;
} c[10];

int main()
{
cout << "Enter information of Customer:\n " << endl;


for(int i = 0; i < 10; ++i)
{
c.cstmrnmber = i+1;
cout << "For Customer number" << c.cstmrnmber << ",\n" << endl;

cout << "Enter the name of Customer:\n ";
cin >> c.name;

cout << "Enter the age of customer: \n";
cin >> c.age;

cout << "Enter the Address of Customer:\n ";
cin >> c.address;

cout << "Enter Contact number: \n ";
cin >> c.contactno;

cout << "Enter the temperature: \n";
cin >> c.temp;

cout << endl;
}

cout << "Displaying Information: " << endl;


for(int i = 0; i < 10; ++i)
{
cout << "\nCustomer number: " << i+10 << endl;
cout << "Name: " << c.name << endl;
cout << "Age: " << c.age << endl;
cout << "Address: " << c.address << endl;
cout << "Contact number: " << c.contactno << endl;
cout << "Enter the temperature:" << c.temp << endl;
}
if (age > 21)
{
cout << "Eligible to Enter." << endl;
cout << "no longer a minor." << endl;
}
else if(age < 20)
{
cout << "Not eligible to enter."<< endl;
cout << "Still a minor." << endl;
}
return 0;
}
 
Sa susunod, ilagay sa code tag
C++:
#include <iostream>
using namespace std;

struct customer
{
    int cstmrnmber;
    char name[50];
    int age;
    char address[50];
    double contactno;
    double temp;
};

int main()
{
    struct customer c[10];
    
    cout << "Enter information of Customer:\n " << endl;
 
    for(int i = 0; i < 10; ++i)
    {
        c[i].cstmrnmber = i+1;
        cout << "For Customer number" << c[i].cstmrnmber << ",\n" << endl;
        
        cout << "Enter the name of Customer:\n ";
        cin >> c[i].name;
        
        cout << "Enter the age of customer: \n";
        cin >> c[i].age;
        
        cout << "Enter the Address of Customer:\n ";
        cin >> c[i].address;
        
        cout << "Enter Contact number: \n ";
        cin >> c[i].contactno;
        
        cout << "Enter the temperature: \n";
        cin >> c[i].temp;
        
        cout << endl;
    }

    cout << "Displaying Information: " << endl;


    for(int i = 0; i < 10; ++i)
    {
        cout << "\nCustomer number: " << i+10 << endl;
        cout << "Name: " << c[i].name << endl;
        cout << "Age: " << c[i].age << endl;
        cout << "Address: " << c[i].address << endl;
        cout << "Contact number: " << c[i].contactno << endl;
        cout << "Enter the temperature:" << c[i].temp << endl;
        
        if (c[i].age > 21)
        {
            cout << "Eligible to Enter." << endl;
            cout << "no longer a minor." << endl;
        }
        else
        {
            cout << "Not eligible to enter."<< endl;
            cout << "Still a minor." << endl;
            return 0;
        }
        
        if(c[i].temp < 38)
        {
            //message
        }
        else
        {
            //message
        }
    }
        
    return 0;
}
 
Back
Top