Kkk
I will evaluate the options
Mar!o
lol I know but why is it used?
This just seems like a demo
macros before classes can be there for multiple reasons.
One reason would be to add compiler specific attributes to the class
mito
Anonymous
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
int main()
{
char password [50];
int i;
int low = 0;
int high = 0;
int dig = 0;
printf("Please enter a strong password! \n");
scanf(" %s", &password);
for (i = 0; i < 50; i++)
{
if (islower(password[i]))
{
low = 1;
break;
}
}
for (i = 0; i < 50; i++)
{
if (isupper(password[i]))
{
high = 1;
break;
}
}
for (i = 0; i < 50; i++)
{
if (isdigit(password[i]))
{
dig = 1;
break;
}
}
if ((low * high * dig) != 0)
{
printf("You have entered a strong password. \n");
}
else
{
printf("You have entered a weak password. \n");
}
}
Anonymous
Here in the above case, 'islower' function won't works, may I please know the reason as there was no errors and warnings in the code
Anonymous
Anonymous
But if I skip upper case or digit then it will say you have entered a weak password
Anonymous
Sorry for disturbing, thanks for the quick response.
Could be a some bug, now the issue got resolved
Anonymous
Are there any function to verify for special characters ("$*#+#..) as in alpha, uppercase, lower case, digits... ?
Anonymous
Anonymous
Ok
Satania
Has anybody read this book? Wanted to know your thoughts about it before I bought it: https://www.amazon.com/dp/1789343623/
Anonymous
how do i go about serializing the following?
std::vector<std::initializer_list<double>> position {{1, 2}, {5, 6} };
std::vector<std::initializer_list<double>> color { {3, 4}, {7, 8}};
assuming i only have access to pointers to my data, and i have a vector which defines the order in which the pointers must be serialized
std::vector<void*> order = {&position, &color};
for example
// possible imaginary output
double * serial = serialize_initializer_list({position[0], color[0], position[1], color[1]});
•‿•
can someone guide me what is output of this code
•‿•
#include <stdio.h>
int main()
{
float x = 1.1;
while (x == 1.1)
{
printf("%f \n", x);
x = x - 0.1;
}
return 0;
}
Anonymous
how do i go about serializing the following?
std::vector<std::initializer_list<double>> position {{1, 2}, {5, 6} };
std::vector<std::initializer_list<double>> color { {3, 4}, {7, 8}};
assuming i only have access to pointers to my data, and i have a vector which defines the order in which the pointers must be serialized
std::vector<void*> order = {&position, &color};
for example
// possible imaginary output
double * serial = serialize_initializer_list({position[0], color[0], position[1], color[1]});
You can use zip algo in ranges library by Eric Niebler. That does exactly what you want.
Anonymous
•‿•
thanks
Anonymous
thanks
I have updated the link. Posted the wrong link by mistake. Check the updated one which answers why you shouldnt do floating point comparisons the way you have done it.
jep
struct seat
{
char name[99];
char address[99];
int age;
int seatNo;
}passenger,temppass;
int main()
{
int selection, seat_number, Age;
char Name[99], Address[99];
system("cls");
jep
Anyone help
When i type
A1 in seatNo.
It becomes error
Anonymous
S__R
https://pastebin.com/ZrAMz2XK i am getting error on iterator
Anonymous
https://pastebin.com/ZrAMz2XK i am getting error on iterator
Sets dont have an emplace_back method. The position where a value is inserted in a set is determined by comparisons operator in the case of regular sets and hashing in the case of unordered_set (both of which can be overridden obviously)
jep
So what declaration should i use?
Anonymous
anyone helpme out to do simple c program?
jep
This is my first I'm so sorry
Anonymous
Anonymous
S__R
jep
Anonymous
Anonymous
cafejoy
Anonymous
?
https://github.com/ericniebler/range-v3
Anonymous
i am not sure how that would help me
Anonymous
?
There is a zip method in ranges library which combines elements from two different sequences together. That is what you want.
Anonymous
i am not sure how that would help me
Even if you cant use ranges (the learning curve might be a bit steep initially), why cant you just use iterators and iterate through your vectors of initialization_list.
It shouldnt take more than 5 minutes to write such code.
Anonymous
hmmm ok
S__R
worked
Anonymous
how do i go about serializing the following?
std::vector<std::initializer_list<double>> position {{1, 2}, {5, 6} };
std::vector<std::initializer_list<double>> color { {3, 4}, {7, 8}};
assuming i only have access to pointers to my data, and i have a vector which defines the order in which the pointers must be serialized
std::vector<void*> order = {&position, &color};
for example
// possible imaginary output
double * serial = serialize_initializer_list({position[0], color[0], position[1], color[1]});
if that works, then my problem would be figuring out how to convert my underlying structures into this ^
Anonymous
how do i go about serializing the following?
std::vector<std::initializer_list<double>> position {{1, 2}, {5, 6} };
std::vector<std::initializer_list<double>> color { {3, 4}, {7, 8}};
assuming i only have access to pointers to my data, and i have a vector which defines the order in which the pointers must be serialized
std::vector<void*> order = {&position, &color};
for example
// possible imaginary output
double * serial = serialize_initializer_list({position[0], color[0], position[1], color[1]});
https://pastebin.com/TWc47G1L
Here you go. Just to spice it up a little, I even used initialization_lists of different length.
Anonymous
Anonymous
hmm
Anonymous
how would i do the same thing if my data structure is this
template <typename storage_type, typename data_type>
class Buffer {
Kernel kernel;
public:
HANDLE add(data_type data);
storage_type * get(HANDLE handle);
void remove(HANDLE handle);
Table::Iterator getIterator();
};
class VertexInfo {
public:
Buffer<std::initializer_list<double>, std::initializer_list<double>> dataBuffer;
size_t length;
bool is_static;
HANDLE static_data = nullptr;
VertexInfo(size_t length, bool is_static) {
this->length = length;
this->is_static = is_static;
}
};
Buffer<VertexInfo, VertexInfo> vertexBuffer;
std::initializer_list<HANDLE> vertexBufferOrder;
Anonymous
Anonymous
well, in
std::vector<std::initializer_list<double>> position {{1, 2}, {5, 6} };
std::vector<std::initializer_list<double>> color { {3, 4}, {7, 8}};
std::vector<void*> order = {&position, &color};
...
Anonymous
Anonymous
Anonymous
Anonymous
Anonymous
oh i remember now
Anonymous
C programming all tutorials please give me
Anonymous
Anonymous
would i do this?
https://gist.github.com/40246db4452518f46a0e5dfec944bf46
In your case, you want all the buffers to be the same size. In my code, I assumed they will be of different size and hence output "empty" for the missing elements. So yes, your code looks fine for the assumptions you made. And instead of using hasNext and so on, try to implement the increment operators for your iterator and use them. That way making changes in future will be easier.
Anonymous
something like this?
Object * obj = iterator.next();
while (obj != nullptr) {
std::initializer_list<double> *data = info->dataBuffer.get(obj->handle);
obj = iterator.next();
Anonymous
Anonymous
hmm
I am 1 year engineering stude t
hmm
I need to learn c and c++ Lagaugu s
Anonymous
Anonymous
Hello guys . Can you tell me c programming tutorials( variable , if or if else and etc..... )
Anonymous
Anonymous
seems difficult
It is not. You just overload operator*, operator->, operator++ and operator++(int) for your iterator class.
Anonymous
with my current iterator i just do this
class Iterator {
Table * table;
size_t index = 0;
size_t page = 1;
public:
Iterator(Table * t);
void skip(size_t amount);
bool hasNext();
Object * next();
};
Iterator getIterator();
Table::Iterator::Iterator(Table *t) {
table = t;
}
void Table::Iterator::skip(size_t amount) {
for (int i = 0; i < amount; ++i) {
hasNext();
next();
}
}
bool Table::Iterator::hasNext() {
size_t page_size = this->table->page_size;
for (; this->page <= this->table->Page.count(); this->page++) {
this->index = ((page_size * this->page) - page_size);
for (; this->index < page_size * this->page; this->index++)
if (this->table->table[this->index] != nullptr)
return true;
}
return false;
}
Object* Table::Iterator::next() {
return this->table->table.at(this->index);
}
Table::Iterator Table::getIterator() {
return Iterator(this);
}
Anonymous
Anonymous
Anonymous
wtf?
/Users/smallville7123/StudioProjects/Graphical-Tool-Kit/app/src/main/cpp/VertexEngine/VertexEngine.h:22:63: error: use 'template' keyword to treat 'get' as a dependent template
name
return kernel.getHandle(handle)->object->resource.get<storage_type*>();
^
template
template <typename T> T get() const {
if (isDebug) {
LOG_INFO_MESSAGE("AnyOptCustomFlags get");
}
return get_impl<T>();
}
Anonymous
Anonymous
does that only work normally when storage_type is not a template name?
eg get<int*>();
Anonymous
ok
Anonymous
Anonymous
um is this normal?
* frame #0: 0x00000001011bf380 libWINAPIKERNEL.dylib`Table::Page::count(this=0x0000000000000020) at WindowsAPITable.cpp:164:15
(lldb) p this->table
(WindowsAPITable *) $4 = 0x0000000000000000