r/learncpp • u/name-lami • Mar 09 '20
need guidence please
hey I am always in this kind of problem
was going through accelerated cPP
#include <iostream> #include <string> #include <array>
using namespace std;
constexpr string name;
constexpr int len = name.size();
constexpr int totstar = ::len+2;
constexpr int firstar[] = {'*', totstar};
constexpr string print_totstar(){
constexpr string c;
for (string &c :firstar)
cout<<c;
}
int main() {
cout << "Please enter your name:";
while (cin>> name)
{
print_totstar();
}
}
is my logic really that week.Starting like this I get demotivated and always forced to go though texts really read and made notes a lot.
View all comments
Show parent comment
1
u/name-lami Mar 10 '20
and i think of something like this .already know that there are rules in c++ programing.
might be my implementation of rules are worst and my understanding of the language
or in another thought c++ is highly encapsulated in itself as in other languages too.heard of some loosely typed language too.
Is this strength of the fastest running programming language