|
DavidCrow:
What I mean is that I don't know how to write a for loop statement that write out spaces, instead of characters.
|
|
|
|
|
A space is just another character. What's wrong with:
for (int x = 0; x < 5; x++)
cout << " ";
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
The idea is to make a pyramid of spaces the same way you made the one you posted, but one character shorter, then write asterisks for the remainder of the line length:
for (int i = 1; i < 5; i++){
for (int j = 1; j < i; j++){
cout << " ";
}
for (; j < 5; j++){
cout << "*";
}
cout << endl;
}
Also your loops use commas rather than semicolons, which won't compile; I fixed that in my example.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Thaddeus Jones:
THANK YOU. I was able to to twist your codes around to achieve my goal. I know you are testing my c++ skills. Since I just learned how to write an inverted pyramid of asterisk, I was able to substitute asterisks for spaces, and write two pyramids into one project.
|
|
|
|
|
Anytime
modified 13-Sep-18 21:01pm.
|
|
|
|
|
This is a code to update a process monitoring program when the value changes, the following code is the invoke. To me it looks right, but the code wont function, the error is "Object reference not set to an object instance." What to do?
private void LocalProcesses_Update(int ProcessID, int ValueIndex, string NewValue)
{
if (this.InvokeRequired == true)
{
object[] newList_Item = new object[] { ProcessID, ValueIndex, NewValue };
this.Invoke(new InvokeProcessList(LocalProcesses_Update), newList_Item);
}
else
{
LocalProcesses.BeginUpdate();
LocalProcesses.Items[ProcessID.ToString()].SubItems[ValueIndex.ToString()].Text = NewValue;
LocalProcesses.EndUpdate();
LocalProcesses.Refresh();
}
}
modified 5-Dec-11 9:06am.
|
|
|
|
|
What line is the error on? If I had to guess, it's the fact that you have object[] as an object type.
|
|
|
|
|
This looks more like C# code; are you sure you've posted this to the correct forum? It would also help if you put <pre> tags around your code so it is readable.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Good point... that does look like C# now that I look closer.
|
|
|
|
|
I'm also amazed at how many C# programmers apparently have no clue as to the meaning of the message "Object reference not set to an object instance.".
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Richard MacCutchan wrote: C# programmers dabblers apparently have no clue as to ...
FTFY
|
|
|
|
|
hi,
is there any method to find out file is password protected or not.
thanks.
|
|
|
|
|
What file? Please be more specific.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
word or excel type files.
|
|
|
|
|
HI,
i just want to know, if i inter-change my office document file to each other, like .doc, to .xls or .ppt
than after interchanging the file type the file not open properly when i m trying to open now is there any way to identify waht is the original file type/
thanks.
|
|
|
|
|
Short answer: No.
The file type of a file is whatever it is at the moment you access it. Unless it contains some control information which identifies what it was created from then there is nothing that will help you.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Le@rner wrote: i just want to know, if i inter-change my office document file to each other, like .doc, to .xls or .ppt
What do you mean by "inter-change a file"?! A document file cannot be somehow magically converted to a spread sheet, and vice versa. If you just renamed the file to change its extension (from .doc to .ppt), that doesn't mean power point can open it now.
And how is your question even related to C++ or MFC?!
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
i am reading file properties,
i want to indetify these type of file in my application.
|
|
|
|
|
Le@rner wrote: i am reading file properties,
from where?
|
|
|
|
|
using CComPtr<ishellfolder2> pShellFolder2;
|
|
|
|
|
I was thinking the same thing... those file types he named aren't even anything alike.
|
|
|
|
|
As Richard MacCutchan mentioned, the file content can give you a hint. Although programs are free to write whatever they want in files, many popular file types contain signatures that make them recognisable.
This[^] page contains a list with many file extensions and their signatures, including Microsoft Office files.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
i chked.
my all word,excel or ppt file had D0 CF 11 E0 A1 B1 1A E1
and no hint find on 512 byte offset,
now how can i idetify the file.
|
|
|
|
|
As I said before, there is no guaranteed method to identify file types. Much of Microsoft's software uses specific patterns as identifiers within their files but the information tends to change and is generally not published.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Assuming by 'interchange' you mean rename, then no.
If you mean you load it into MS Office as one type and then use 'save as' to store it in another format (e. g. load a .xls into a word document and then store the rsulting document as .doc), then you can no longer expect to be able to open it with the original program. You may be able to convert it back, but usually you'll lose a lot of extra information that way.
In any case, on Windows file name suffixes are directly tied to applications. That is why, when you try to rename a file suffix in Explorer, you will get a warning that you may no longer be able to properly open and work with that file.
Unfortunately MS never thought to force aplications to store file types right into the file itself rather than encoding it into fickle properties such as a name suffix. It makes too much sense I suppose...
|
|
|
|