Here is a simple C++ program that reads user names and units consumed, then calculates and prints the charges based on a rate per unit:
#include <iostream>
#include <string>
#include <vector>
int main() {
int n;
std::cout << "Enter number of users: ";
std::cin >> n;
std::vector<std::string> names(n);
std::vector<int> units(n);
const double rate = 1.5; // Rate per unit
for (int i = 0; i < n; ++i) {
std::cout << "Enter name and units consumed: ";
std::cin >> names[i] >> units[i];
}
std::cout << "\nCharges:\n";
for (int i = 0; i < n; ++i) {
double charges = units[i] * rate;
std::cout << names[i] << ": $" << charges << std::endl;
}
return 0;
}
This program prompts the user for the number of users, then collects their names and units consumed, and finally calculates and displays the total charges based on a fixed rate.
write a lex program to delete space from the program
How to write a program for mouse in microprocessor?
To write a C++ program to display the student details using class and array of object.
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
how to write a program that counts automorphic number from 1 to 999
write a lex program to delete space from the program
write an assembly language program to find sum of N numbers
write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html
fdsgfhgdfhgdf
How to write a program for mouse in microprocessor?
program to find maximum of two numbers using pointers
write it in 8085
To write a C++ program to display the student details using class and array of object.
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
VBnet program to find the prime numbers between 100 to 200?
how to write a program that counts automorphic number from 1 to 999
fish