What's new

Closed Pahelp naman po

Status
Not open for further replies.

Jirachi2016

Eternal Poster
Joined
Feb 20, 2016
Posts
739
Reaction
190
Points
269
Age
23
20201114_144446.png
 

Attachments

#include <iostream>
using namespace std;

struct customer
{
int cstmrnmber;
char name[50];
char address;
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: ";
cin >> c.name;

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

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

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

cout << endl;
}

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


for(int i = 0; i < 10; ++i)
{
cout << "\nCustomer number: " << i+1 << endl;
cout << "Name: " << c.name << endl;
cout << "Address: " << c.address << endl;
cout << "Contact number: " << c.contactno << endl;
cout << "Enter the temperature:" << c.temp << endl;
}

return 0;
}
 
#include <iostream>
using namespace std;

struct customer
{
int cstmrnmber;
char name[50];
char address;
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: ";
cin >> c.name;

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

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

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

cout << endl;
}

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


for(int i = 0; i < 10; ++i)
{
cout << "\nCustomer number: " << i+1 << endl;
cout << "Name: " << c.name << endl;
cout << "Address: " << c.address << endl;
cout << "Contact number: " << c.contactno << endl;
cout << "Enter the temperature:" << c.temp << endl;
}

return 0;
}
 
Issues:
  • yung address is defined as char, so single char.
  • yung contactno at temp defined as double, so not unless may input validation ka, mage-exit agad yan.
 
Status
Not open for further replies.

Similar threads

Back
Top