C++Extra (Add-on) (New!) (Please try!)

Pages: 123

I have created my own custom little add-on like thing for c++, called C++Extra it adds lots of new features!

C++Extra (Version 0.01)
http://www.filedropper.com/cextra

I hope it helps you alot! Please reply feedback and anything I should add!

Planned Features:

Make the load() command be customizable, for example
a border around it or not.

var() - You type the variable name between ( and ) and
it will created a variable called that.

print() - It is cout but more easyer to type, just type text
in the ( and ).

wait() - Type a number of mili-seconds to wait between
( and ). It basically waits for the number of mili-seconds.


Current Features:

clear() - Clears the console
load() - Adds a short, but effective loading screen
Last edited on
1. I don't download anything from crappy upload sites like filedropper
2. You've not explained what this even is, what it does, or how to use it
3. If it's open source, you should consider putting it on GitHub (or learning how to)
4. Don't make your entire post all bold and italic
That's great, but LB is right. An example of what LB is talking about is a bunch of libraries I made (https://github.com/usandfriends/CLibraries ). These libraries help with string management, console management, system management, and vector management. When making libraries, it's also good to add a waiver and a ReadMe (something which I still have to do).
Last edited on
@usandfriends you're just as guilty for using the deprecated non-standard conio.h
https://en.wikipedia.org/wiki/Conio.h
I know. Also, these libraries are good for Windows & DOS only. These are things I'm currently trying to fix. (Which is why I added a waiver.)
Last edited on
Good for Windows only? They're good for DOS maybe, at best.
closed account (S6k9GNh0)
usandfriends, I'll be blunt. ncurses, pdcurses, and curses all do the same thing you're trying to do except much better using a common standard. It's fine if you do this stuff for fun or to learn but don't present it to people expecting positive outcome. Your competition is years ahead of you...

EDIT: Also don't call a library a C++ add-on *facepalm*
Last edited on
closed account (S6k9GNh0)
Just so everyone can see the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#include <cstdlib>
#include <iostream>
#include <windows.h>

/*
Credits:
        
Devolper: Toggy11

*/

/*
Info:
     
Please do NOT say this code is yours.
If you want to make changes to it that
is fine. You MUST ask me if you want
to make a download for ANY version
of C++Extra, wether it be your
version or the one supplied by
download.
*/

int clear()
{
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
    cout << "" << endl;
}

int load()
{
    cout << "Loading. . ." << endl;
    cout << "1%" << endl;
    Sleep(600);
    cout << "5%" << endl;
    Sleep(600);
    cout << "11%" << endl;
    Sleep(600);
    cout << "23%" << endl;
    Sleep(600);
    cout << "26%" << endl;
    Sleep(600);
    cout << "37%" << endl;
    Sleep(600);
    cout << "41%" << endl;
    Sleep(600);
    cout << "43%" << endl;
    Sleep(600);
    cout << "47%" << endl;
    Sleep(600);
    cout << "56%" << endl;
    Sleep(600);
    cout << "67%" << endl;
    Sleep(600);
    cout << "72%" << endl;
    Sleep(600);
    cout << "75%" << endl;
    Sleep(600);
    cout << "83%" << endl;
    Sleep(600);
    cout << "91%" << endl;
    Sleep(600);
    cout << "94%" << endl;
    Sleep(600);
    cout << "98%" << endl;
    Sleep(600);
    cout << "100%" << endl;
    Sleep(1500);
    cout << "Done loading!" << endl;    
}


I sense a troll despite how conservative I am with accusations.
Last edited on
Ummmm, what the hell is that? I had no idea that's what loading screens were doing all this time, seems like a waste to me.
closed account (S6k9GNh0)
Reminds me of Windows lol. "herm... that's odd. It seems to say 100% but... its not done?"
Last edited on
The OP says the loading screen is effective.
closed account (3qX21hU5)
Why is everyone being so harsh? It is quite obviously that the OP is just starting to learn the language and yes it might seem like nothing to more experienced programmers but he is just starting out and it is probably a big deal for him.

I know when I first started with C++ I even got excited the first time I made "Hello World!" appear and wanted to share it with everyone.

Now it's great if you are giving constructive criticism to the OP by letting him know that there are other libraries that do this type of thing and do it much better, or giving suggestions on how to improve his project. Or even by saying he should post somewhere like github so people don't have to download a unknown file.

But most of these replies aren't about giving feedback that is helpful instead they are about mocking the OP and making fun of something he probably spent a lot of time on. Yes the code he posted isn't very useful to most people but that doesn't mean he deserves to be mocked for it. He is just a beginner that is just starting out with learning the language.
closed account (S6k9GNh0)
I'm being harsh because you can't claim something does something when it doesn't. It's nice that hes new and learning but this is ridiculous. Have confidence but know your current limitations.
closed account (Dy7SLyTq)
i would normally agree with you zereo, however he did oversell it. i mean even when i first tried to make a clearing screeni realized there must be a better way. and he wrote
load() - Adds a short, but effective loading screen

it just prints some random numbers and sleeps. it doesnt load anything. im not saying im perfect ( http://www.cplusplus.com/forum/lounge/77958/ (that was my old account and look at how i oversold that. turns out cat has the -n flag)) but you should at least be realistic with what your "selling"
Toggy11, it is good that you are attempting to do something more than what your teacher or text book asked you to do. Keep writing code, trying out ideas that come to your mind; that is how one learns programming.

You header needs an include guard. http://en.wikipedia.org/wiki/Include_guard

A header file may be included in more than one translation unit. Functions defined in the header files need to have either internal linkage, or if they have external linkage, they need to be inline.
http://en.wikipedia.org/wiki/One_Definition_Rule
http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=41

Names in the standard library are in the namespace std. std::cout etc.

For readability and maintainability, avoid magic numbers (like 600) in your code. http://en.wikipedia.org/wiki/Magic_number_(programming)#Unnamed_numerical_constants

For repetitive constructs, use a loop.

With a conforming C++ implementation, we can eliminate the dependancy on the Windows platform. The standard library has functionality equivalent to that provided by the Windows Sleep() function.

To print a new line character, use '\n'. Use std::endl only when you also want to force a flush of the stream (produce a line of output immediately). http://en.cppreference.com/w/cpp/io/manip/endl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// include guard
#ifndef CPP_EXTRA_H_INCLUDED
#define CPP_EXTRA_H_INCLUDED

#include <iostream>

// <chrono> and <thread> are standard C++ headers
#include <chrono>
#include <thread>

/*
Credits:

Devolper: Toggy11

*/

/*
Info:

Please do NOT say this code is yours.
If you want to make changes to it that
is fine. You MUST ask me if you want
to make a download for ANY version
of C++Extra, wether it be your
version or the one supplied by
download.
*/

inline void clear() // inline function with external linkage
            // can be defined (identically) in multiple translation units
{
    static const int PAGE_SIZE = 50 ; // number of lines per page
    
    for( int i = 0 ; i < PAGE_SIZE ; ++i ) // print PAGE_SIZE empty lines
        std::cout << '\n' ;
}

static void load() // static => internal linkage
             // eaxh translation unit has its own definition
{
    // 600 milliseconds
    static const auto delay = std::chrono::milliseconds(600) ;

    std::cout << "Loading. . .\n" ;

    // this requires a conforming C++ compiler
    // for every integer 'percent' in the brace-enclosed-list
    for( int percent : { 1, 5, 11, 23, 26, 37, 41, 43, 47, 56, 67,
                          72, 75, 83, 91, 94, 98, 100 }  )
    {
        std::cout << percent << '%' << std::endl ; // force an immediate line of output
                                                   // before we go into a wait state

        // sleep for the duration specified  
        // http://en.cppreference.com/w/cpp/thread/sleep_for
        std::this_thread::sleep_for( delay ) ;
    }

    std::cout << "Done loading!\n" ;
}

#endif // CPP_EXTRA_H_INCLUDED 
In his defense, I once published a tutorial and part of the tutorial involved a fake loading screen. The tutorial was deleted because of the confusion caused and I was talked to, ofc...
First of all I am a beginner I am not perfect. Also I never said I am "selling" this libary. Did I? I do not mean to be unthankful for feedback but this is my first REAL project and not everything is perfect at the start. For example I know a libary where a new thing was introduced everyone hated it but it got changed a bit and people liked it alot. I guess what I am saying is this is by a beginner, its not perfect, im not "selling" it either...



Just a note I don't intend this to be helpful for experienced coders. I want it to be useful for beginners. Yestoday when I posted this I showed one of my friends and he acctually liked the clear console thing. Like what Zereo said im not a experienced coder! If I was on the fourms when you posted your first program like hello world. I wouldn't of mocked you and said it was stupid and useless.



I will work on it ALOT more and probably repost this topic.
Nah it's pretty well. I'm sure we all made that loading screen once upon a time.

Good for your first real project.
closed account (Dy7SLyTq)
We are only telling you not to oversell. Its great that your learning but its bad to tell people you can do something you can't, which is what starts to happen when you oversell the code. And u never said you were selling it, but you are, ot at least the idea of it.
Nah it's pretty well. I'm sure we all made that loading screen once upon a time.


Not me. Not ever.

I hate when games (and programs in general) make you wait.

;P
Last edited on
Pages: 123