Coders GTFIH IMMEDIATELY!!!!!!!!!!!!!!!!!!!!!!

FunnyVALENTINE

FunnyVALENTINE

D4C LOVE TRAIN
Joined
Apr 19, 2026
Posts
1,523
Reputation
1,534
C++:
#include<iostream>
#include<vector>
#include<string>
#include<unordered_map>
#include<cctype>
#include<filesystem>
#include<algorithm>
#include<random>
#include<bitset>
#include<set>
#include<string_view>
#include<memory>
#include<cmath>
#include<fstream>
#include<limits>
#include<sstream>

using std::vector;
using std::string;
using std::unordered_map;
using std::bitset;
using std::cout;
using std::cin;
using std::cerr;



class item
{
    public:

        string item_Name{};
        long long item_quantity{};
        long double item_cost{};
        long double total_cost{};
        bool existing_item{};

        void input()
        {
            bool name_valid{};
   
        do{
       
            name_valid = true;
            existing_item = false;
            cout<<"Enter the name of the item: ";
            std::getline(cin,item_Name);


        if(item_Name.length() < 4 || item_Name.length() > 20)
        {
            cout<<"Name should not be less than 4 or more than 20 characters\n";
            name_valid = false;
            continue;
        }
       
        bool itemExists(const string& name);
        if(itemExists(item_Name))
        {
            cout<<"Item Exists\n";
            existing_item = true;
            return;
        }

        for(char a: item_Name)
        {
            if(!std::isalpha(static_cast<unsigned char>(a)))
            {
                cout<<"Name should only be Alphabets\n";
                name_valid = false;
                break;
            }
        }
        if(!name_valid)
        {
            continue;
        }

        }while(!name_valid);

       
     
        //Asking quantity of item
        while(true)
        {
       
        cout<<"Enter the Quantity of the item: ";
       

        if(cin>>item_quantity)
        {
            cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
            break;
        }
       
        cout << "Quantity should only contain numbers.\n";

        cin.clear();
        cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');

        };

        //Asking Cost of Item
        while(true)
        {
       
        cout<<"Enter the Cost of the item: ";
       

        if(cin>>item_cost)
        {
            cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
            break;
        }
       
        cout << "Cost should only be numbers.\n";

        cin.clear();
        cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');

        };
       
        //Calculating total cost
        total_cost = static_cast<long double>(item_quantity * item_cost);

    }


};

int main()
{
    item a{};
   
    int option{};
   
    do{
    cout<<"1.Input a new Item"<<'\n';
    cout<<"2.Modify an existing item's quantity"<<'\n';
    cout<<"3.Modify an existing item's cost"<<'\n';
    cout<<"4.Delete an Item"<<'\n';
    cout<<"5.Exit"<<'\n';
   
    cout<<'\n';
    cout<<"Enter a value between 1-5 to begin operation: ";
    cin>>option;
    cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
    cout << '\n';
   

    if(option == 1)
    {
    a.input();
   
    if(!a.existing_item)
    {
        if (!std::filesystem::exists("database.csv"))
        {
            std::ofstream abc{"database.csv"};
            abc << "Name,Quantity,Cost,Total Cost\n";
        }

        std::ofstream abc{"database.csv", std::ios::app};

        abc << a.item_Name << ','
            << a.item_quantity << ','
            << a.item_cost << ','
            << a.total_cost << '\n';
       
    }
    }

    else if(option == 2)
    {
       vector<string> lines{};
       string line{};

       std::ifstream tyu{"database.csv"};

       std::getline(tyu,line);

       while(std::getline(tyu,line))
       {
            lines.push_back(line);
           
       }

       string new_item{};
       cout<<"Enter the name of item you wanna modify?: ";
       std::getline(cin,new_item);
       cout<<'\n';

       for(int i = 0; i < lines.size(); ++i)
       {
            std::stringstream ss(lines[i]);
            string name{};
           

            std::getline(ss, name, ',');
           
            if(name == new_item)
            {
             
                    std::string quantity;
                    std::string cost;

                    std::getline(ss, quantity, ',');
                    std::getline(ss, cost, ',');
                   
                    int new_quantity{};
                    cout<<"Enter New Quantity: ";
                    cin>>new_quantity;

                    long double new_cost = std::stold(cost);
                    long double total = new_quantity * new_cost;

                    lines[i] = name + "," +
                    std::to_string(new_quantity) + "," +
                    cost + "," +
                    std::to_string(total);

                    std::ofstream out("database.csv");

                    out << "Name,Quantity,Cost,Total Cost\n";

                    for (const auto& record : lines)
                    {
                        out << record << '\n';
                    }
               
            }
       }
     
    }

    else if(option == 3)
    {
        vector<string> lines{};
        string line{};

        std::ifstream tyu{"database.csv"};

        std::getline(tyu,line);

       while(std::getline(tyu,line))
       {
            lines.push_back(line);
           
       }

       string new_item{};
       cout<<"Enter the name of item you wanna modify?: ";
       std::getline(cin,new_item);
       cout<<'\n';

       for(int i = 0; i < lines.size(); ++i)
       {
            std::stringstream ss(lines[i]);
            string name{};
           

            std::getline(ss, name, ',');
           
            if(name == new_item)
            {
             
                    std::string quantity;
                    std::string cost;

                    std::getline(ss, quantity, ',');
                    std::getline(ss, cost, ',');
                   
                    long double new_cost{};
                    cout<<"Enter New Cost: ";
                    cin>>new_cost;

                    long long new_QUANTITY = std::stoll(quantity);
                    long double new_total = static_cast<long double>(new_cost * new_QUANTITY);

                    lines[i] = name + "," +
                    quantity + "," +
                    std::to_string(new_cost) + "," +
                    std::to_string(new_total);

                    std::ofstream out("database.csv");

                    out << "Name,Quantity,Cost,Total Cost\n";

                    for (const auto& record : lines)
                    {
                        out << record << '\n';
                    }
               
            }
       }
       
    }

    else if(option == 4)
    {
        vector<string> lines{};
        string line{};

        std::ifstream tyu{"database.csv"};

        std::getline(tyu,line);

       while(std::getline(tyu,line))
       {
            lines.push_back(line);
           
       }
       string new_item{};
       cout<<"Enter the name of item you wanna delete?: ";
       std::getline(cin,new_item);
       cout<<'\n';

       for(int i = 0; i < lines.size(); ++i)
       {
            std::stringstream ss(lines[i]);
            string name{};
           

            std::getline(ss, name, ',');
           
            if(name == new_item)
            {
                    string quantity{};
                    string cost{};
                    string total{};

                    std::getline(ss, quantity, ',');
                    std::getline(ss, cost, ',');
                    std::getline(ss,total,',');

                    lines[i] = name + ',' + quantity + ',' + cost + ',' + total;

                    lines.erase(lines.begin() + i);

                    std::ofstream out("database.csv");

                    out << "Name,Quantity,Cost,Total Cost\n";

                    for (const auto& record : lines)
                    {
                        out << record << '\n';
                    }
                break;
            }
           
       }

    }

    else if(option == 5)
    {
        cout<<"Saving.....\n";
    }

    }while(option !=5);

    return 0;
}

bool itemExists(const string& name)
{
    string stored_data{};

    std::ifstream def{"database.csv"};

    std::getline(def, stored_data);

    while(std::getline(def, stored_data))
    {
        std::stringstream ss(stored_data);
        string Item_name{};
        std::getline(ss,Item_name,',');

        if(Item_name == name)
        {
            cout<<"Checking.......\n";
            return true;
        }
    }

    return false;
}

THE CODE ABOVE IS A STOCK MANAGEMENT SYSTEM.
@Jason Voorhees help me my nigga :Chadge:

I want you to do 2 things.

1.Check my code and compare it to professional level:Chadge:.
2.Tell me how should i Improve :Chadge:.

Also I'm going to learn Qt and Opengl in this month .
So i can make GUI based Applications.
 
Last edited:
  • +1
Reactions: Chadeep, Jason Voorhees, Nox𓂀 and 2 others
import even more stuff faggot
 
  • +1
Reactions: Nox𓂀 and nestivv
I don't understand a single line of this code :Hmmm:
 
  • JFL
  • +1
  • So Sad
Reactions: Chadeep, Glorious King, Nox𓂀 and 1 other person
c++ is for faggots use C
 
  • +1
Reactions: Nox𓂀, FunnyVALENTINE and nestivv
Did I make a mistake by learning C++ :feelsthink: ?
 
  • +1
Reactions: Nox𓂀
Did I make a mistake by learning C++ :feelsthink: ?
Learning C++ is good, using it in the modern world is bad.

There are simpler and easier options to code, which consumes less time. Regardless, not using Codex or Claude is retarded.
 
  • Hmm...
Reactions: FunnyVALENTINE
ask claude code and tell it to make no mistakes and triple check 100x

1783175377683


@Glorious King

1783175403679
 
  • JFL
Reactions: HaileyWelshMogs, Jason Voorhees and Glorious King
That pajeet Jason voorhees won't be able to help, he only has call center experience
 
  • Hmm...
Reactions: FunnyVALENTINE
That pajeet Jason voorhees won't be able to help, he only has call center experience
Still living rent free I see. Seethe harder nigga. 🤣
 
  • +1
Reactions: FunnyVALENTINE
Also one more thing the way professional coders write code isn't the most impressive mind blowing with 100 method calls, solving every edge case with 1000 lines of code.The best code is the one that solves the problem in the fewest lines and fewest possible steps. Start seeing every line of code as a liability every race condition waiting to break, a potential bug, a security risk, or a maintenance burden. Once you start doing that you are already half way through becoming better than 90% or coders and even AI

1000213358
 
Last edited:
  • Love it
Reactions: FunnyVALENTINE
Also one more thing the way professional coders write code isn't the most impressive mind blowing with 100 method calls, solving every edge case with 1000 lines of code.The best code is the one that solves the problem in the fewest lines and fewest possible steps. Start seeing every line of code as a liability every race condition waiting to break, a potential bug, a security risk, or a maintenance burden. Once you start doing that you are already half way through becoming better than 90% or coders and even AI

View attachment 5313420
Bhai what would you rate my code out of a 10 on a professional level :HMMMM: ?
 
  • +1
Reactions: Jason Voorhees
That pajeet Jason voorhees won't be able to help, he only has call center experience
You have any advice :HMMMM:?
What would you rate my code out of a 10 on a pro level :HMMMM:?

Man :DankPepe: you are sus
 
  • Hmm...
Reactions: Clqs
Bhai what would you rate my code out of a 10 on a professional level :HMMMM: ?
I haven't read it. Send me a dm and I could comment. But asking people to rate code isn't a good idea. Most people judge code by how complex it looks, not by how stable it is. For a junior, that just teaches you bad habits like over engineering even im guilty of this. What you should aim for is readability and maintainability. Ask AI for this. Ask it how readable and maintainable it is and if there's a cleaver way to do it. Cleaver code and simple code are two different things
 
  • +1
Reactions: FunnyVALENTINE

Similar threads

FunnyVALENTINE
Discussion Coders gtfih
Replies
12
Views
73
FunnyVALENTINE
FunnyVALENTINE
FunnyVALENTINE
Replies
6
Views
74
FunnyVALENTINE
FunnyVALENTINE
whosnigging
Replies
0
Views
19
whosnigging
whosnigging
Mogs Me
Replies
9
Views
115
Wuzzdio
W
darodiddler
Replies
23
Views
128
darodiddler
darodiddler

Users who are viewing this thread

  • FunnyVALENTINE
Back
Top