|
Its only used as a loop counter. If you prefer we could do
while(num--)
{
s = val_arg(args, QString);
} That, of course alters the value of num, so if you need to know how many args were passed in, or need to traverse the argument list again, you don't want to do that.
Keep Calm and Carry On
|
|
|
|
|
Message Closed
modified 15-May-23 19:07pm.
|
|
|
|
|
Member 14968771 wrote: PS I did post same request on QT forum
Given the complete lack of detail in your "question", you'd have better luck posting it on a "psychic hotline" forum instead.
Even people who are "familiar with QT Bluetooth CODING" can't guess what your secret code is doing, nor what the secret problem is.
If you want someone to help you, you need to start by asking a proper question, with enough details to explain the problem and to show the relevant parts of your code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
is there how to work on google even knowing any programming language variation?
|
|
|
|
|
Uhh... what?
And what does this have to do with C/C++?
|
|
|
|
|
Not with those types of questions.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
If you're looking for work at Google or another international (and especially US-based) company, you should work on your grasp of the english language first.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Hi
I have a question regarding the pie method in CDC there are eight parms the first 4 represent the bounding rectangle in which the ellipse or the circle is enclosed the last 4 represent the starting and ending points and of the arc
my question is for the last 4 why is the "Y' vertical parm necessary it would always seem to be from the center of the arc to its edge
I hope my question makes sense
thanks
|
|
|
|
|
"Y", the radius at x = 0, varies with the angle of the arc (as a point on the circumference).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Tell me if I am right I think I first need to determine the angle so if is 25 % then the angle is 90 4 / 360 then to get the y it’s y = consin(angle) x = sin(angle)
Right ?
|
|
|
|
|
|
Thanks for help one more follow up question
Would this equation not have to be multiplied by the number of pixels per circle degree I mean the formula is the same for big and small circles so you have to taken into account the size of the circle I’m sure I can do it with GetCientrect
Thanks
|
|
|
|
|
The radius determines the size of a circle. If you want to scale, you vary the radius.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
My client etc is a square so either the width or height divided by 2
Ok thanks
|
|
|
|
|
When doing drawing first you do it to memory than BitBlt to the device -> device context can to you save the memory dc to a file ?
thanks
|
|
|
|
|
|
I am writing a pie chart using pie and ellipse first doing CreateCompatableBitmap Selecting to mem dc but the example will work
thanks
|
|
|
|
|
No, as shown in the documentation at GetDC function (winuser.h) - Win32 apps | Microsoft Docs[^]:
Quote: The GetDC function retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC. The device context is an opaque data structure, whose values are used internally by GDI.
You need to save other information that you use to create the drawing.
|
|
|
|
|
I am writing a pie chart using pie and ellipse first doing CreateCompatableBitmap Selecting to mem dc but the example will work
Mircea provided an example that will work for me
thanks
|
|
|
|
|
ForNow wrote: Mircea provided an example that will work for me
Yes. However in this example the bitmap is saved into the file, and not the memory or some other DC (device context)!
|
|
|
|
|
The incomplete code bellow doesnt seem to be working as intended. I would be really gratefull to any help.
#include<iostream>
#include <fstream>
#include<cstring>
using namespace std;
const int N=20; <pre lang="C++"><pre lang="text"><pre lang="C++"></pre></pre></pre>
const char Filename[]= "Shiplist.dat";
struct Ship {
unsigned int number;
float capacity;
char name[50];
};
fstream sp;
int menu() {
int choice;
cout << "\n \t MENU";
cout << "\n 1. Add individual ships";
cout << "\n 2. Add a list of ships";
cout << "\n 3. Print the list of all ships on screen";
cout << "\n 4. Show the ships with the biggest load capacity ";
cout << "\n 5. Search ship by name";
cout << "\n 6. Add shipments";
cout << "\n 7. Cancel shipments";
cout << "\n 8. Save ship information";
cout << "\n 9. Add new ship to the list";
cout << "\n 10. Exit";
do {
cout << "\n Your choice:"; cin >> choice;
} while (choice<1 || choice>10);
return choice;
}
Ship input () {
Ship S= { 0 };
cin.ignore();
cout << "\n Enter ship number:"; cin >> S.number;
cin.ignore();
cout << "\n Enter the name of the ship:"; cin.getline(S.name,50);
cout << "\n Enter the load capacity of the ship:"; cin >> S.capacity;
return (S);
}
int enter (Ship Lib[], int n) {
int i, m;
do {
cout << "\n Enter information for how many ships(max 5 in one go):";
cin >> m;
} while(m<0 || m>5);
if (n+m < 20) {
for (i= n; i<n+m; i++) {
cout << "\n Ship " << i+1;
Lib[i]= input();
}
return (n+m);
} else cout << "\n You can't add any more ships!";
}
void Save_File (Ship Lib[], int n) {
sp.open(Filename, ios::binary | ios::out);
if (!sp) { cout << "\n Error in file! \n"; exit(1); }
sp.write((char*)Lib, sizeof(Ship) * n);
sp.close();
}
void append () {
Ship b= { 0 };
sp.open(Filename, ios::binary | ios::app);
if (!sp) { cout << "\n Error in file! \n"; exit(1); }
cout << "\n Add a new ship to the list \n";
b= input();
sp.write((char*)&b, sizeof(Ship));
sp.close();
}
void output (Ship Lib[], int n) {
int i, k=0;
cout << "\n \t List of all ships \n";
for (i=0; i<n; i++) {
cout << "\n" << i+1 << "\t" << Lib[i].number << " " << Lib[i].name << " " << Lib[i].capacity ;
k++; if(k % 5 == 0) cout << "\n\n\n\n\n\n";
}
}
int Load_File (Ship Lib[]) {
long pos; int n=0, i; Ship b;
sp.open(Filename, ios::binary | ios::in);
if (!sp) { cout << "\n File doesn't exist!! \n"; return n; }
sp.seekg(0L, ios::end);
pos= sp.tellg();
sp.close();
n= pos/ (sizeof(Ship));
sp.open(Filename, ios::binary | ios::in);
if (!sp) { cout << "\n Error in file! \n"; exit(1); }
for (i=0; i<n; i++) {
sp.read((char*)&b, sizeof(Ship));
Lib[i]=b;
}
sp.close();
return n;
}
void Ship_by_Name (Ship Lib[], int n) {
char Sname[50];
cin.ignore();
cout << "\n Ship name: ";
cin.getline(Sname, 50);
for (int i = 0; i < n; i++)
if (!strcmp(Sname, Lib[i].name)) {
cout << "\n Ship found!";
cout << "\n Number: " << Lib[i].number << "\t Name: " << Lib[i].name << "\t Load capacity: "
<< Lib[i].capacity;
break;
} else cout << "\n This ship isn't recorded!";
}
int main () {
int choice, n=0;
Ship Lib[N];
char answ= 'y';
n= Load_File(Lib);
do {
choice= menu();
switch (choice) {
case 1: input(); break;
case 2: n= enter(Lib, n); Save_File(Lib, n); break;
case 3: n= Load_File(Lib); output(Lib, n); break;
case 5: n= Load_File(Lib); Ship_by_Name(Lib, n); break;
case 8: Save_File(Lib, n); break;
case 9: do {
append(); n++;
cout << "\n One more[y/n]? " << "\n Answer: "; cin >> answ;
Save_File(Lib, n);
} while (!(answ == 'N' || answ == 'n')); break;
}
} while (choice != 10);
}
|
|
|
|
|
This kind of thing is usually posted as a question. On the menu bar just under the site banner, click on quick answers/Ask a Question.
However, "doesn't seem to be working as intended" tells us nothing about what your code is trying to do, and no one is going to waste time trying to guess. You have to provide more details if you want an answer.
|
|
|
|
|
Ship input () {
Ship S= { 0 };
cin.ignore();
cout << "\n Enter ship number:"; cin >> S.number;
cin.ignore();
cout << "\n Enter the name of the ship:"; cin.getline(S.name,50);
cout << "\n Enter the load capacity of the ship:"; cin >> S.capacity;
return (S);
}
It will help get a quicker answer if your code is properly indented, and uses the correct <pre> tags as above.
|
|
|
|
|
panda08 wrote: The incomplete code bellow.... If you completed, would it then work?
panda08 wrote: The incomplete code bellow doesnt seem to be working... Was it intentional that you failed to explain what it is (not) supposed to do?
panda08 wrote: ...as intended. What is its intent?
The onus is on you to pare down your code to just that which is problematic; not ours to wade through a bunch of code to try and figure out what it is supposed to do and why it is not doing such.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hi
I have been trying to write to the non client area of a window specifically a Cdialog
This CDialog has a Rich Edit (I am displaying storage obtained) and I am trying to give details about it in the Non client area
seems to me there are 3 choices if I want to make it look nice nice means using the CDC class
1) process the ON_WM_NcPaint 2) using windows desktop manager (extending the frame and making it the client area) 3) using a static control / window
was wondering if someone could guide on which path to take
thanks
|
|
|
|