I managed to write successfully my code that I have been wanting to write for some years now, but I want to align the text that is displayed in the output screen but I haven't been able to. I've tried adding and taking away numbers from the identifiers but nothing.
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #define ARRAYSIZE 2 #define FORMAT "First Name Pago1 Pago2 Pago3 Pago4 Total Net" #define FORMATHEADER "Last Name "
I need to create certain objects which are listed in a file. So my code needs to run a loop and create objects(of type specified in file) and put them in a list.
It appears to me that type specifiers can't be replaced by string. Is there a way out ? I want following code to be working somehow.
#include <iostream> #include <string> using namespace std;
#include <stdio.h> #include <math.h> main() { int n; int k; int j; //gets user input for length of string printf("Enter the value of n:"); scanf("%d", &n);
[code]......
When I compile my code I get an error saying that I need declaration specifiers in my is_prime subroutine in the for loop.
I realize that implicit int rule was removed in C99 but gcc still takes this approach by default. I wonder why this happens:
bbb = 5; // legal int main(void) { aaa = 10; // illegal auto aaa = 10 // legal
Inside function a specifier is needed. Error message with no specifier used is:
error: ‘aaa’ undeclared (first use in this function)
Is this because of linkage - bbb variable has an external linkage so compiler knows that we are defining a variable here while inside mean() we need to show compiler that aaa is defined right here, it does not come from external functions?
Basically when I type in different widths and heights for the col and rows, the buttons that make up the width get cut off. Something is messed up but I'm not sure what!
InitializeComponent(); int _col = int.Parse(cols); int _row = int.Parse(rows); int width = groupBox1.Width; int height = groupBox1.Height; int bW = width / _col; int bH = height / _row;
The program is when a person clicks a button this button updates 2 separate listbox one tracks the total rolls the other displays the total amounts of frequency afterwards adjusting labels as a scaling measurement.
The problem I am having is right at the end where I am trying to adjust the width of the label this is what I have. It is highlighting the word "Items" for each label and says that Non-Invokable member 'System.Windows.Forms.ListBox.Items' Cannot be used like a method L2 is a label. Additionally I have added in the information for one of my loops below the line I am having trouble with this loop is created to determine how many lines are in the listbox of rolls and I have no trouble with this just thought id add it for additional information I dont think I need to add the rest of the code but I can if needed.
L2.Width = int.Parse(lstfrequency.Items(0).ToString()); TL = 0; for (I = 0; I <= 10; I++) { TL += int.Parse(lstfrequency.Items[I].ToString()); } lstfrequency.Items.Add(TL);
Define functions n(), s(), e(), w(), center(), ne(), se(), sw() and nw(). Each takes a Rectangle argument and returns a Point. These functions define connection points on and in the rectangle. For example, nw® is the northwest (top-left corner) of a rectangle called r.
I wrote below code for that:
#include <Simple_window.h> Point n(const Graph_lib::Rectangle& r); Point s(const Graph_lib::Rectangle& r); Point e(const Graph_lib::Rectangle& r); Point w(const Graph_lib::Rectangle& r); Point ne(const Graph_lib::Rectangle& r); Point se(const Graph_lib::Rectangle& r);
[Code]...
As you see, this just mark the top-left corner of the rectangle r. In other functions I need the specifications of that rectangle, for example its height and width. How to use these specs in those functions?
I am drawing two circle (inner circle and outer circle) using DrawElipse method. I have created two pen object named OuterPen and InnerPen and creating Outer Circle using OuterPen and Inner Circle using InnerPen. Problem that I am facing is that when I increase the size of outer pen lets say 10px then it overlaps the inner circle and inner circle is hide. How can I increase the size of OuterPen outwards and not inwards so that it don't overlap the inner circle?
Code: #include <stdio.h> int main() { float number1, number2; printf("Enter two numbers separated by a comma "); scanf("%f,%f", &number1, &number2);
[Code] ....
When it prints the values, it prints them as I want. the problem is, what happens when someone puts in values with different width and precision? Here I had to write in the width and precision to display the values that are specified in the book. but what happens when someone puts in something that doesn't have those width/precision?
I end up with a lot of zeros after the number. initially I got 24.000000 (zeros are not accurate amount) I needed to show just 24. (with the decimal)
So I included %2.0f which gave me 24 (without the decimal point) what if some one put in 24.556. I got 25 as a result.
Does the width mean how many numbers in total including the decimal point and that is a minimum?
I am trying to set the width of the data values which the user will input when using the program but I don't know how to get it to show the values when I tryto set the width of the variables in a nice column .
I derived a class from CRecentFileList in order to set the number of displayed chars for MRU.
The problem is that if I open the app with 256 set for this number (it is read from .ini file) the display is correct. But after I change it to 10 for e.g., File menu width remains unchanged altghough MRU are correctly displayed on 10 (or at least file name lenghts) chars.
how can I tell to the menu to shrink to actual width?
How to read and write an arbitrary number of bits from/to a file stream.
For instance, how to repeatedly read 9 bits from a file, then change to 10 bits, then 11 bits, and so on?
Obviously one way is by doing a lot of bit shifting, and masking. But honestly, I'm too dumb to get it right. Then I thought about using std::bitset and std::vector<bool>.
How would I make it so that I can have someone input the length, width and height for all 3 boxes and then have it output the sum and average volume? Here's an example of what I would like:
INPUT - Enter Box 1 (Length, Width, Height): 10.1 11.2 3.3 INPUT – Enter Box 2 (Length, Width, Height): 5.5 6.6 7.7 INPUT – Enter Box 3 (Length, Width, Height): 4.0 5.0 8.0 OUTPUT – The sum of the volume is 812.806 OUTPUT – The average volume is 270.935
Here's my original code:
#include <iostream> using namespace std; double box(double length, double width, double height); // use double data int main() { double sum; sum = box(10.1, 11.2, 3.3) + box(5.5, 6.6, 7.7) + box(4.0, 5.0, 8.0);