C++ Codes basic to advance
782 subscribers
4 photos
2 videos
49 links
Download Telegram
C++ Codes basic to advance pinned «Notes 📝 : Telegram.me/BCA_Sem1_Notes Telegram.me/BCA_Sem2_Notes Telegram.me/BCA_Sem3_Notes Telegram.me/BCA_Sem4_Notes Telegram.me/BCA_Sem5_Notes Telegram.me/BCA_Sem6_Notes Code practice Channels: Telegram.me/C_Codes_pro Telegram.me/CPP_Codes_pro Telegram…»
//To check leap year 
#include<iostream>
using namespace std;
int main() {
    int year;
    cout << "Enter a year that you want to check:";
    cin>>year;
    if((year%4==0 &&year%100!=0) ||( year%400==0))
        cout<<year<<" is a leap year"<<endl;
    else
        cout<<year<<" is not a leap year"<<endl;
    return 0;
}
//@CPP_CODES_PRO
इस बाॅट में कोड रन करना सीखें
Learn how to run code in this bot.

See bot with Full tutorial: https://t.me/logicBots/147

लाभ (Advantage):
आप किसी को भी रियल टाइम में कोड का आउटपुट दिखा सकते हो, जिससे अगर आपके कोड में कोई गलती है तो वह भी सरलता से एक दूसरे से डिस्कस करके साॅल्व कर सकते हो।

See features written in pic ☝️☝️

You can show the output of the code to anyone in real time, so that if there is any mistake in your code, they can easily solve it by discussing with each other.

Full tutorial: https://t.me/logicBots/147
👍1
// Print any number table

#include <iostream>

using namespace std;

int main() {
    int num;
    cout << "Enter a number: ";
    cin >> num;
   
    cout << "Table of " << num << ":" << endl;
    for(int i=1; i<=10; i++) {
        cout << num << " x " << i << " = " << num*i << endl;
    }

    return 0;
}
// @CPP_Codes_pro
👍1
Learn in 55 seconds
How to run codes in telegram 👇
https://t.me/logicBots/163
// Swastik pattern
#include<iostream>
using namespace std;

int main() {
int n;
cout << "Enter Number: ";
cin >> n;
for(int k = 1; k <= n * 2 - 1; k++) {
for(int l = 1; l <= n * 2 - 1; l++) {
if(k == n || l == n || k == 1 && l >= n || k <= n && l == 1 || k >= n && l == n * 2 - 1 || k == n * 2 - 1 && l <= n)
cout << " *";
else
cout << " ";
}
cout << endl;
}
return 0;
}
/*1 2 3 4
1 2 3
1 2
1*/
#include<iostream>
using namespace std;       
int main() {
int n;
cout<<"Enter range:";
cin>>n;
    for(int i=n; i>=1; i--) {
        for(int j=1; j<=i; j++) {
            cout<<j<<" ";
        }
        cout <<endl;
    }
    return 0;
}
/*4
3 4
2 3 4
1 2 3 4*/
#include<iostream>
using namespace std;
int main() {
int n;
cout<<"Enter range:";
cin>>n;
for(int i=n; i>=1; i--) {
for(int j=i; j<=n; j++) {
cout<<j<<" ";
}
cout <<endl;
}
return 0;
}
👍1
Ab aap log apna khud ka Compiler bot bana sakte hain easily 🥳🥳🔥
Apne manpasand name aur username se

Create your own
By using @CloneCompiler_bot

See full details: Click Here
// Event Emitter class

#include <iostream>
#include <functional>
#include <vector>

using namespace std;

class EventEmitter {
private:
    struct FuncObj {
        string mesType;
        std::function<void(int)> callback;
    };

    vector<FuncObj> funcs;

public:
    EventEmitter() {}

    void on(string mesType, std::function<void(int)> callback) {
        funcs.push_back(FuncObj{ mesType, callback });
    }

    void emit(string mesType, int obj) {
        for (auto& funobj : funcs) {
            if (funobj.mesType == mesType) {
                funobj.callback(obj);
            }
        }
    }
};

void callback(int a) {
    cout << "hi" << a;
}

int main() {
    EventEmitter e;
    e.on("message", callback);
    e.emit("message", 7);
    return 0;
}
1
Make your 30 numbers final in c/c++ 👇
https://t.me/C_Codes_pro/254

All that program can be converted in c++ just replacing
stdio.h to iostream
And
printf to std::cout
👍1
Now it's discussion group is public
Join @Cpp_group_pro
Select your group/channel/service
t.me/Sid_info/69
// Check leap year
#include <iostream>

bool isLeapYear(int year) {
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
return true;
} else {
return false;
}
}

int main() {
int year;
std::cout << "Enter a year: ";
std::cin >> year;

if (isLeapYear(year)) {
std::cout << year << " is a leap year." << std::endl;
} else {
std::cout << year << " is not a leap year." << std::endl;
}

return 0;
}
👍3
// multiple numbers adder
#include<iostream>
using namespace std;
class Adder{
    public:
    int num[100];
    int n=0;
    void entNum(void);
    void numShow(void);
    void printCal(void);

};
void Adder::entNum(void){
    int i=0;
    char c;
    for(;i<50;i++){
    cout<<"Enter "<<i+1<<"s number : ";
    cin>>num[i];
    n++;
    if(i<1)
    continue;
    cout<<"Are you want add more type y or n ";
    cin>>c;
    if(c=='n')
    break;
} }

void Adder::numShow(void){
    cout<<"\n\nYou entered ";
    for(int i=0;i<n;i++){
    cout<<num[i]<<" ";
    }}
   
void Adder::printCal(void){
    int i=0;
    int res=0;
    for(;i<n;i++){
    res=res+num[i];
    }
    cout<<"\nTotal = "<<res;
}
int main (){
    Adder add; 
    cout<<"Number Adder\n"<<endl;
    add.entNum();
    add.numShow();
    add.printCal();
    return 0;
    }
👍2
If you want learn js for website development 👇join it
@react_next_js

For any problems in js site development feel free to ask questions 😊👇
@reactjs_nextjs_group