Denkz for the dank code
Hello all just wrote a basic program that's main purpose is too take in information for said account and display it back to you.
Code:#include <iostream> #include <windows.h> #include <stdio.h> #include <string> class Account { public: std::string name, pin; void Register() { std::cout << "Please enter you're name: " << std::endl << std::endl; std::getline(std::cin, name); std::cout << "Please enter a pin: " << std::endl; std::getline(std::cin, pin); system("cls"); std::cout << "Thank you for registering " << name << std::endl; Sleep(2000); std::cout << "Please wait a moment while we take you to you're account " << std::endl; Sleep(7000); Login(); } void Login() { std::cout << "Account information: " << std::endl << std::endl; std::cout << "Name : " << name << std::endl; std::cout << "Pin : " << pin << std::endl; Sleep(3000); std::cout << "Thank you for testing this system" << std::endl; std::cout << "goodbye " << std::endl; Sleep(1000); } }; int main() { std::cout << "Hello welcome!" << std::endl << std::endl; Account accountobject; accountobject.Register(); return 0; }
Last edited by Astralblack; 03-10-2017 at 06:21 AM.
For fucks sake. It's "your account" and "your name", not "you're account" or "you're name"...
Last edited by PraiseCthulhu; 03-10-2017 at 12:22 PM.
Silent (05-08-2017)
lel opps. sowwy
Noice, now extend it
bananas float in water
I plan to add more complex functions to it the more I l learn. I will release it when I feel it is up to my standards and when it does what my goals intended it to do.
You should use "Hello world\n" or "Hello world\n\n" for double lines. std::endl flushes the stream which makes it slow compared to just "\n"
I was not aware of this, thank you. I will use that in my future code.
To make my code secure, bug free as possible and efficient is my goal haha
Why didn't you just use the private access specifier for your strings?
But still good work.
Last edited by Fresh[Verde]; 03-25-2017 at 04:51 AM. Reason: Praise
Updated code, with some fixed things.
Code:#include <iostream> #include <string> class Data { public: void Register(); void Login(); private: std::string name, password; }; void Data::Register(){ std::cout << "Please enter a name \n"; std::getline (std::cin, name); std::cout << "Please enter a password \n"; std::getline (std::cin, password); std::cout << std::endl; getchar(); Login(); } void Data::Login(){ std::cout << "\t Name: " << name; std::cout << "\t Password: " << password; getchar(); } int main(){ Data db; db.Register(); }
Last edited by Astralblack; 03-30-2017 at 07:29 PM.
Congratz with ur first program though
Thank you.