\Device\NUL
Extra note The standards require that the argument c for these functions is either EOF or a value that is representable in the type unsigned char. If the argument c is of type char, it must be cast to unsigned char, as in the following example: char c; ... res = toupper((unsigned char) c); This is necessary because char may be the equivalent of signed char, in which case a byte where the top bit is set would be sign extended when converting to int, yielding a value that is outside the range of unsigned char. The details of what characters belong to which class depend on the locale. For example, isupper() will not recognize an A-umlaut (Ä) as an uppercase letter in the default C locale.
Madhavi
I need help with: Struct a []{ Int data, Int valid } Array [4]; If (a[1].valid==1 && a[2].valid==1 && a[3].valid==1){ Return false; } How to code this logic with for loop
Pavel
I am beginner how i can improve my c++ programming language
Make your projects, read articles/books, practice
Jojo
Hello need help on repairing windows recovery, any one
Madhavi
I need help with: Struct a []{ Int data, Int valid } Array [4]; If (a[1].valid==1 && a[2].valid==1 && a[3].valid==1){ Return false; } How to code this logic with for loop
Madhavi
for (int i=0 ; i < 3 ; i++){ // what logic to put here for Check if(a[1].valid ==1 && .......) }
Madhavi
But how about the && of all the index
\Device\NUL
But how about the && of all the index
You need to write logic if the value valid member isn't one than return false or break
Madhavi
Logic i am thinking is too create a number a[1].valid|a[2].valid |a[3].valid if number is 111 .. check buy number && 111 if result is 111 return false
Madhavi
Any other better optio
klimi
you want to put int into bits?
Sachin
#include <iostream> #include <vector> #include<algorithm> using namespace std; int main() { vector<vector<int>> ans; vector<int> v; v.push_back(1); v.push_back(2); v.push_back(3); ans.push_back(v); v.clear(); v.push_back(4); v.push_back(5); v.push_back(6); v.push_back(7); ans.push_back(v); v.clear(); v.push_back(8); v.push_back(9); v.push_back(10); v.push_back(11); ans.push_back(v); v.clear(); for(auto it: ans) { for(auto k: it) cout<<k<<" "; } //OUTPUT 1 2 3 4 5 6 7 8 9 10 11 reverse(ans.begin(),ans.end()); cout<<"\n"; for(auto it: ans) { for(auto k: it) cout<<k<<" "; } //OUTPUT 8 9 10 11 4 5 6 7 1 2 3 return 0; } I want output to be 11 10 9 8 7 6 5 4 3 2 1
Sachin
any one who know this?
Konstantin
any one who know this?
You reversing ans, but it has 3 vectors inside that should be reversed too
Sachin
how ?
Konstantin
how ?
It's your code. You almost did it once. Obviously you can cycle through vectors in ans and use reverse with each.
Sachin
for(auto it: ans) { reverse(it.begin(),it.end()); }
Sachin
this?
Misagh
I need help with: Struct a []{ Int data, Int valid } Array [4]; If (a[1].valid==1 && a[2].valid==1 && a[3].valid==1){ Return false; } How to code this logic with for loop
You can use the STL: if (std::all_of(std::begin(array)+1, std::end(array), [](const a) { return a.valid == 1; }) return false;
Johnson
Please guys can anyone help me to convert this to a for loop char *_strcat(char *dest, char *src) { int a; int b; a = 0; while (dest[a] != 0) { a++; } b = 0; while (src[b] != 0) { dest[a] = src[b]; a++; b++; } return (dest); }
Johnson
For loop usually requires a statement and the increment is passed as a statement in the for loop parenthesis but the while loop has it's increment within the curly braces. Converting it to a for loop has been an issue. Kindly help and explaintion will do. Thanks in advance
\Device\NUL
for (i = 0; arr[i] != '\0'; i++) Nothing hard
Baka
can u code it please
for (auto it = v.rbegin(); it != v.rend(); it++)
Anonymous
Make your projects, read articles/books, practice
Please give me some articles , books
Pavel
Please give me some articles , books
If you passed beginner level I suggest these 3 books: Effective C++, More Effective C++, Modern Effective C++ from Scott Meyers Then fluentcpp.com is a good resource for advanced reading. I don't have good suggestions for complete beginners, I was learning by shitty books, making mistakes and asking questions on toxic russian programming forums 😄 Try also this:
Ali
Find the errors in the following code and explain why. include <iostream> using namespace std; class Book { public: Book(int i = 0 ); void displayId(); private: int id; }; Book::Book(int i) { id = i; } void Book::displayId() { cout << id << endl; } void main() { Book X( 10 ); Book* Y; Y = new Book( 20 ); X.displayId(); Y.displayId(); (*Y).displayId(); Y->displayId(); delete Y; delete X; delete &X; Y = &X; Y->displayId(); delete Y; Y = new Book( 30 ); Y = new Book( 40 ); delete Y; delete Y; }
Nobody🪲
#include<stdio.h> int main() { int bs,da,hra; float gs; printf("please enter your basic salary "); scanf("%d",&bs); da=bs*.4; hra=bs*.2; gs=da+bs+hra; printf("%f",gs); getch(); }
Nobody🪲
Whats wrong with this code..if i input 30,000 the gross salary comes 48,000 but in online solution ans is 18,000 why they substrate
Ludovic 'Archivist'
So yes, bs + bs*0.6 is more than bs
Norah
Please I have error in dec c++ say (Id returned 1exite status)
Norah
klimi
Yes
What's that?
klimi
Dev c++
Oh... Okay... Well that doesn't provide nearly any information about your problem
𝕯𝖆𝖛
#algorithm #rectangle_query #rtree #c++ Hello, I am doing a rectangular query on the rectangles given in the plane. Rectangles intersecting the query rectangle are returned at the end of the problem. I use Rtree. But I do not understand many things. Please help և give directions.
Jojo
C GUI and c event handler....are this real
Yash
Hey I have written a create function in the struct node... but I am getting error as linked_list.c: In function ‘create’: linked_list.c:47:13: error: parameter name omitted 47 | void create(int) | ^~~ Here is my program: #include<stdio.h> #include<stdlib.h> struct node{ int data; struct node *next; }*head=NULL,*temp,*new_node; void create(int); void display(int); void insert(int); void delp(int); void delv(int); void search(int); void reverse(int); int n; int main(){ int pos,op=1; while (op>=1 || op<8) { printf("\n1) Create the linked list."); printf("\n2) Display the linked list."); printf("\n3) Inesrt a node."); printf("\n4) Delete a node by position."); printf("\n5) Delete a node by value."); printf("\n6) Search data."); printf("\n7) Revers the linked list."); printf("\n8) Exit"); printf("Enter the choice : "); scanf("%d",&op); switch(op) { case 1 : if (head==NULL) printf("ERROR!! Linked list is already created!"); else printf("Enter how many nodes you want : "); scanf("%d",&n); create(n); } } } void create(int) { int i; for (i=0;i<n;i++) { new_node=(struct node *)malloc(sizeof(struct node)); printf("Enter the data : "); scanf("%d",&new_node->data); if (head==NULL) head=temp=new_node; else temp->next=new_node; temp=new_node; } }
Yash
Please help...
Adriano
You need to give a name for the parameter when you define it the function,
Adriano
Like "void created (int name_here)
Yash
Thank you broo... let me try it....
Yash
🙏Thanks...
Sid
Any one please suggest any source for problem solving of c++
Sid
I want to practice more and more
Yongyi
Can you help me to write code of Diamond shape in c programming? Please
shriman_deepak
Can you help me to write code of Diamond shape in c programming? Please
Use two for loops one for space and one for * or whatever character u want
Sandeepta
tcs codevita mario3 solution
klimi
tcs codevita mario3 solution
It doesn't work like that
Sandeepta
How
shriman_deepak
vec(m+1,0) mean empty vector of size m+1 ?
Anonymous
Whats wrong with this code..if i input 30,000 the gross salary comes 48,000 but in online solution ans is 18,000 why they substrate
Probably they want you to calculate just the sum of HRA and Dearness Allowance (DA) alone.
Anonymous
vec(m+1,0) mean empty vector of size m+1 ?
It is not an empty vector. It is a vector of size m+1 where all the elements are 0.
Sid
It is not an empty vector. It is a vector of size m+1 where all the elements are 0.
Plz suggest me a source for pointer and reference practice
Sid
C++
Sid
And web source where I can practice?
Anonymous
#algorithm #rectangle_query #rtree #c++ Hello, I am doing a rectangular query on the rectangles given in the plane. Rectangles intersecting the query rectangle are returned at the end of the problem. I use Rtree. But I do not understand many things. Please help և give directions.
I don't know what Rtree is. But to find if a rectangle intersects another rectangle, you just have to check if the boundary of a rectangle lies within or on the query rectangle and vice-versa which is a straightforward exercise
Sid
Means I had recently completed the theory of those topics and want a bunch of question
Sid
For practice
Anonymous
Means I had recently completed the theory of those topics and want a bunch of question
I am not aware of any. Usually people start working on projects once they learn the language's syntax. So check some projects on GitHub
Sid
Okey