0% found this document useful (0 votes)
2 views

class and objects

The document contains three C++ programs: one for a banking system that allows for account initialization, deposits, withdrawals, and balance display; another for checking if a number is 'GOOD' based on the absence of zeros; and a third for simulating coin toss outcomes based on given ranges. Each program demonstrates basic input/output operations and control structures in C++. The code snippets illustrate object-oriented programming concepts through the use of classes and methods.

Uploaded by

c.mohanavel234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

class and objects

The document contains three C++ programs: one for a banking system that allows for account initialization, deposits, withdrawals, and balance display; another for checking if a number is 'GOOD' based on the absence of zeros; and a third for simulating coin toss outcomes based on given ranges. Each program demonstrates basic input/output operations and control structures in C++. The code snippets illustrate object-oriented programming concepts through the use of classes and methods.

Uploaded by

c.mohanavel234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Rbi sum

#include <iostream>

#include <string.h>

using namespace std;

class Bank{ private:

char name[50];

char accounttype[50];

int acc;

double balance;

public:

void initial()

{ std::cin>>name>>acc>>accounttype>>balance; }

void deposit()

{ float deposit;

cin>>deposit;

balance+=deposit; }

void withdraw() { float withdraw;

cin>>withdraw;

if(withdraw>balance){ cout<<"Insu icient Balance\n";}

else balance-=withdraw; }

void disp() {
cout<<"NAME="<<name<<"\nACCNO="<<acc<<"\nTYPE="<<accounttype<<"\nBALANC
E AMOUNT="<<balance<<endl; }

};

int main(){

Bank obj;

obj.initial();
obj.deposit();

obj.withdraw();

obj.disp();

return 0;

Rohan is enthustiastic guy

#include <iostream>

#include <string>

using namespace std;

class GoodNum {

public:

void check(long long N) {

string number = to_string(N);

int zeroCount = 0;

for (char c:number) {

if (c == '0') {

zeroCount++;

if (zeroCount == 0) {

cout << "GOOD Number" << endl;

} else {

cout << zeroCount << endl;

}}};

int main() {

long long N;

cin>>N;

GoodNum Learning;
Learning.check(N);

Evelin and ramya and tossing

#include <iostream>

#include <vector>

#include <algorithm>

class Coin {

public:void Toss()

int x, y, a, b;

std::cin >> x >> y >> a >> b;

std::vector<std::pair<int, int>> outcomes;

for (int i = a; i <= x; ++i) {

for (int j = b; j <= y; ++j) {

if (i > j) {

outcomes.emplace_back(i, j);

std::cout << outcomes.size() << "\n";

for (const auto& outcome : outcomes) {

std::cout << outcome.first << " " << outcome.second << "\n";

}
}

};

int main() {

Coin Game;

Game.Toss();

return 0;

You might also like