yagiD 0 Light Poster

Well, it is "guaranteed" since mark192 says he is using windows XP and not necessarily looking for portability.

On the other hand, neik_e mentions portability problems which is true (+using a system cmd is costly) However, with careless use of i/o functions (buffer problems), mostly because of the mistakes that inexperienced programmers make, program might not halt. This does not happen with system "pause". This is the second reason why it is guaranteed.

So, how bad it is, it might become handy all of a sudden.

yagiD 0 Light Poster

Look for the implementation of "InputBox"

yagiD 0 Light Poster

Another one for a guaranteed result;

system("pause");
yagiD 0 Light Poster
for(n=2;n<=limit;n++)
{
    t=0;
    for(p=2;p<=n/2;p++)
   {
        if (n%p==0)
        {
             t=1;
             break;
        }
    }
    if(!t) cout<<n<<endl;
}
yagiD 0 Light Poster

- p should start from 2
-inner loop should break if remainder == 0, else it is a prime no.

yagiD 0 Light Poster

This may not be your complete code. As far as I can see, you may need

- function prototypes before calling them
- to be careful with types

Furthermore since c++ is there for oop, change whole thing into oop approach (i.e. to a circle class)

yagiD 0 Light Poster

You need to define suitable types or use type casting.

*** Furthermore, you should use code tags when you publish code on this forum.

yagiD 0 Light Poster
printf("integers not divisible by 2 and 3 between 1 and 100");
yagiD 0 Light Poster

Try something like that.

main()
{
    char no[5], str[10], cmd[5], op[20];
    FILE* input = fopen("input4.txt","r");
    while(!feof(input))
    {
        fscanf(input, "%s %s %s %s", &no, &str, &cmd, &op); //no, str, cmd, operand
        
        char *search=",";
        char *op1=strtok(op, search);
        char *op2=strtok(NULL,search);
        char *op3=strtok(NULL,search);
        
        //you can transform this into some other output while avoiding NULLs with if etc.       
        printf("%s %s %s %s %s %s\n", no, str, cmd, op, op2, op3);
    }
}
yagiD 0 Light Poster

look for a list of string functions in C.

yagiD 0 Light Poster

how about using a visual c++.net windows forms application, so that you can make use of objects like image boxes etc..

yagiD 0 Light Poster

You can look for ShellExecute windows API function.

yagiD 0 Light Poster

Here is a zip one

yagiD 0 Light Poster

Here is the link to the zipped and compiled "toprinter.exe". Unzip it to the bin folder of your project.

The simple program takes a file name like "example.txt" as a parameter as shown in the c# code.

Later, if you wish, you can try to turn the whole stuff into a dll or use interoperability. But, anyhow, this will solve your problem.

yagiD 0 Light Poster

That might be what you are looking for

//C++ 2005
	private: void DeleteIt()
	{
	    if (listView1->SelectedItems->Count>0)
  	        listView1->Items->RemoveAt(listView1->SelectedIndices [0]);
	}
yagiD 0 Light Poster

@sarehu
Thank you for your detailed explanation. After reading job' s problem again, I agree that random access files may not seem the very solution to job' s specific problem. But in case he has much information of similar length, they might become handy.

yagiD 0 Light Poster

look for "random access files"

yagiD 0 Light Poster

1-read the no. of files (N) from the config file to an integer variable.

2- You only need one file pointer to create N number of files in a loop. Name them e.g. file1, file2.. fileN

yagiD 0 Light Poster

If you do not want to use managed print controls, I suggest you the following. You can improve this solution.

The following code prints a file using default printer in a windows system (you can easily compile that by any C++ compiler, or by a C compiler by modifying the first header)

#include <iostream>
#include <windows.h>

int main(char* arg)
{
    ShellExecute(NULL, "print", arg, NULL, NULL, 0);
}

I tried to use that code directly in C# using InteropServices or Process class which I failed eventually. So you can do that later, if you wish.

Instead of embedding the code, I simply execute the compiled c++ executable using Process class in C# while sending the file name as a parameter to it.

//the following namespace to be used
using System.Diagnostics;


// the code to execute toprinter.exe (compiled c++ code)
        static void Main(string[] args)
        {
            try
            { 
                Console.WriteLine("Input file name");
                string filename = Console.ReadLine();

                Process myProcess = new Process();
                ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("toprinter.exe" );
                myProcessStartInfo.UseShellExecute = false;
                myProcessStartInfo.Arguments = filename;
                myProcess.StartInfo = myProcessStartInfo;
                myProcess.Start();
                myProcess.WaitForExit();
                myProcess.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
yagiD 0 Light Poster

There are errors in reading from and writing to a file and do-while results in an infinite loop.

yagiD 0 Light Poster

There is a whole lot of events beginning with Cell.. like

private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            MessageBox.Show("I have been changed");
        }

        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            MessageBox.Show("I am being changed");
        }
yagiD 0 Light Poster

Look for C file operations and also how to get the system date. A little googling will do.

yagiD 0 Light Poster

Well, you need to learn more about variable types and arrays as well.

Here is a little help for the last part

for(x = 49; x>-1; x--)
    {
       if(num[x] % 2==0)
       {
           printf ("%i is even\n", num[x]);
       }
       else
       {
           printf ("%i is odd\n", num[x]);
       }
    }
yagiD 0 Light Poster

There is no subtraction in boolean algebra, but bitwise operations like AND, OR, XOR ...

If you look at the ascii table, there is a decimal 32 between lower and upper case. Looking at the workflow in your program, you first print the lower case which has a greater number in the ascii table. It means that you need to subtract to get the upper case. To do a binary subtraction, you can xor the two numbers but here in your case, the int value of the lower case letter is AND masked with the complementary of subtractor. 223 is the complementary of 32 in byte notation (char is 1 byte long)

e.g. at the first step of the loop,
ch=a which is ascii 97
(97)10 = (01100001)2 = a
AND
(223)10 = (11011111)2
---------------------------
65(10) = (01000001)2 = A

You can get the same result with A ^ B (XOR)
or with A & comp(B) as in here.

You may see the gate logic here.

yagiD 0 Light Poster

well, considering that it has not been updated for years, dev c++ has some reported issues with vista.

Before forcing yourself into a decision between vista or devc++, you may try the devc++ forums and mailing lists here and do further googling.

yagiD 0 Light Poster

You can use the DataGridViewImageColumn object. Here is how it' s done.

yagiD 0 Light Poster

First thing you will do is
set BindingNavigator' s DeleteItem to none from the properties box
Doing this, the button will still show but the default event is gone.

Double click afterwards on the delete button and include a similar code like that,

private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Sure you wanna delete?", "Warning", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
               bindingSource1.RemoveCurrent();
        }
yagiD 0 Light Poster

You may not use dynamic components in html without server side scripting.

You may simulate a treeview with some client side script using e.g. javascript or vbscript.

yagiD 0 Light Poster

You can use iteration as follows

foreach (Control t in this.Controls)
                {
                    if (t is TextBox)
                    {
                        //do something
                    }
                }
yagiD 0 Light Poster

You may use .net controls with asp.net.

Here is an article about how to use the treeview control in asp.net 2.0

http://www.15seconds.com/issue/041117.htm

yagiD 0 Light Poster

@alc
the problem is.. express version doesn' t have it.

yagiD 0 Light Poster

if you know/discover your dependencies, you may also use a third party setup script. You may try Innosetup.

yagiD 0 Light Poster

define an array or simply 2 variables.

If you will click a button after your selections, check the .Checked property of radio buttons using for example a foreach loop.

If you want your variables to change right upon clicking the radio button, you can use the following method in the CheckChanged events of the radio buttons as below

void CheckChanged(object sender, EventArgs e)
{
RadioButton radioBtn = (RadioButton)sender;
string myVal;


if (radioBtn.Checked)
{
myVal = "radioBtn.Text";
}
}
yagiD 0 Light Poster

or set the SelectedIndex property to the index of the item

yagiD 0 Light Poster

1. while loop performs loop "if" the condition is true whereas do-while performs it "then" checks if the condition is true.

2. getch makes command line wait for an input from you