Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

They are called Global Variables, your textbook probably discusses them. Most programmers today frown on using global variables because they can cause a lot of confusion and debugging problems. Benefits: not many.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The logic for all those functions is a little off. Look at quadFile() and trace in your mind what it is doing. Notice that there is only one instance of the variable x, y and z, yet the function is reading them multiple times without saving the values anywhere. You need to save all the values of x, y and z somewhere in either an array, linked list, or std::vector so that they can be used in the other functions.

Another way to do it without using an array is for quadFile() to read a line from the text file then call the other two functions. main() only calls one function -- quadFile(). Something like this

quadFile()
{
    while( infile >> x >> y >> z)
    {
        double root1,root2;
        CalcRoots(x,y,z,root1,root2);
        numTable(x,y,z,root1,root2);
    }
}

That function also had two while loops -- the one starting on line 25 is not needed because the loop on 28 will read all the values in the file until eof is reached. Delete the while loop that starts on line 25.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to pass the ifstream that is opened in main() to the function that needs to read the data.

int quadValues(ifstream& in, double &x, double &y, double &z)

And to the function that prints the results

int numTable(ofstream& out, double a, double b, double c, double &root1, double &root2)

Make sure to change the lines in main() that call those two functions. You can then delete the declarations of ifstream inside quadValue() and the declaration of ofstream in numTable() because they are not used.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

According to the comments in that link the probem seems to have been fixed over a year ago.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you don't enter anything on the command line when you start the program then the value of argc will be 1 -- argv[0] is always (almost) the name of the program that's beging run -- and in that case there will be no argv[1].

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Two turkey hotdogs with katsup, mustard, and sweet pickle relish for supper.

Ate a all you can eat sushi bar. It was good.

Might be good, but won't eating raw fish kill you?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First check if you entered a filename on the command line, if you did then the value argc will be greater than 1.

Just make sure there are no spaces in the filename you enter either on the command line or for the prompt "Enter a filename" because cin stops reading at the first space. If you need spaces on the command line then put the string in quotes

c:>myprog.exe "c:\Program Files\filename.txt" <Enter key>

int main(int argc, char* argv[])
{
    std::string filename;
    if( argc > 1) 
    {
       filename = argv[1];
    }
    else
    {
        cout << "Enter a filename\n";
        cin >> filename;
    }
    ifstream in(filename.c_str());

    // rest of program does here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you know how to convert killowatts to watts? If not then use google to find the formula. Once you know the formula writing the program shoud not be too difficult, assuming you have read your textbook and paid attention in class.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can't use *.cpp and *.h files that you created in the console program in C++ language with C#. You will have to modify and translate them into C# language. For example Employee.cpp will become Employee.cs and look something like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication1
{
    class Employee
    {
        public Employee() {}

        private System.String name;

    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are no profits to be made by nuking Syria.

That sounds a bit like Quark from Star Trek :P)
1fdd06eb1222b335164a599b5dcee166

Reverend Jim commented: Hah +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The only reason the US wants to take Military action is to nuke the hell out of Syria,

Proof of that???

The security council and the UN should come up with a peaceful resolution without getting involved.

The UN is incapable of doing anything. Have you ever heard of the UN resolving any conflict anywhere in the world?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 34: case 0x43: // 'C'

why not just this: case 'C':

Won't this work ?

Yes, that's another way to do it.

Won't perror () function work properly ?

perror() does not terminate the program -- it mearly uses errno to print the error message.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you think Syria is a piss-ant sized nation, then why should we even bother to do anything.

Exactly!

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

US wouldn't be wormongeres if all the little piss-ant sized nations like Syria would cut all that crap out. Actually, seems to me I recall this all being started by Syrian people themselves.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't see anything in the hooks that would cause that delay. Have you tried debugging with VC++ debugger?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

? Arrest Asad and his high command for war crimes

Easier said than done. How do you plan to get through his army in order to arrest him??

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you really want someone to look at your code then attach the actual code to your post using the Files link in the purple ribbon above the editor. Most people will not download files from some other place. If the file(s) are too big then zip then up with winzip first.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can't use strings in case statements -- only integers and single characters. If you need strings the only way to do it is with a series of if/else
statements.

"000\";

That is also wrong because the compiler will attempt to use \ as an escape character and out " as part of the string iteself. What you want is one of these two

"000\\"; // make \ part of the string

"000\""; // make " part of the string

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If US does not get involved, things are going to get ugly.

Put your money where your mouth is -- join the Marines and be the first to go over there to put your life on the line. What makes you think it is US responsibility to resolve their problems? Hell, we can't even resolve our own problems.

pritaeas commented: Well said. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 29: If OpenClipboard() fails on that line then you need to make sure the remainder of the code in that function does not get executed because it will most likely crash the program. You might want to create a separate function for it so that it can easily be bypassed.

if (!OpenClipboard(NULL))
{
        perror("Error in clipboard") 
}
else
{
    // do clipboard stuff here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You shouldn't be doing that anyway because it will consume too much cpu time when the clipboard is empty. You need to put a Sleep inside that loop so that other threads can get cpu time.

Second The parentheses in the if statement are mis-placed.

while (true)
{
        if ( (h = GetClipboardData(CF_TEXT)) != NULL )
        {
            //printf ("\n%s", (char *)h ) ;
            break ;
        }
        else
           Sleep(1);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Can you emagine a world without the great pyramids? What a pitty for humanity if those 2,000 year-old objects were destroyed in a war.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

us should not take any military action, that's what united nations for.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to disable all those things in the BIOS -- when the notebook starts to boot press F2 or Del key before Windows starts.

I downgraded my PC a couple weeks ago, all I had to change in the BIOS was disable Secure Boot, and I'm not sure that was even necessary. Windows 7 installed without a problem. I read somewhere on Microsoft site that you can downgrade to Windows 7 and use the same key that you used for Windows 8, but of course you will need a Windows 7 installation disk to do that, and the only way to get the install disk is to buy it, unless you already own it. When you downgrade you will have to reformat the hard drive, so make sure you back up all important files before you start.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I was getting some funky problems earlier today, but nothing at the moment. For example when I clicked on menu Geek's Lounge it would time out and return an error. But that was about 12 hours or so ago. No recent probleds.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't have any idea -- probably have to use mysql database table that includes ip address and counter. I'm sure one of the web geeks will know how to do it with php or some other language.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what operating system?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is your web site written in C language? Probably not.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First you have to create a C++/CLR project that uses .NET framework -- it's called Windows Forms in c++/CLR. If you want to use standard c++ then you can't use System.Drawing. With standard C and C++ use win32 api functions and include windows.h

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Line 12 of Form2 does not make the datagrid public -- it makes a function public. You need to find the line in Form2.h that declares datagridview1 and change it from Private to Public. It should be a line that looks like this:

public: System::Windows::Forms::DataGridView^ dataGridView1;

ddanbe commented: For the effort :) +14
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

:can not access private member declared (e) in the class

which line does that error appear on? Looks like you didn't make the datagrid public.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just open the file and read it one character at a time, passing each character to that function.

void foo()
{
    ifstream in("filename.txt");
    ofstream out("newfilename.txt");
    char c;
    while( in >> c )
    {
       out << EBCDIC_translate_ASCII[c];
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This compiles without errors/warnings. This code is in the button click event handler. Note the placement of Form2.h include below. My Form2 is the same as your Form3 -- I just created a project with VC++ 2010 Express that had two forms, not three as in your project. I think one of your problems was on line 11 below -- gcnew Form2(), not gcnew Form().

If you moved all that initialization into Form3 constructor you wouldn't need to make the grid public.

    #pragma once
    #include "Form2.h"

    namespace WinForms1 {
    using namespace System;
...
...
...

        private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                Form2 ^maForm2 = gcnew Form2();
                 maForm2->dataGridView1->AutoResizeColumnHeadersHeight();

    //       Resize all the row heights to fit the contents of all non-header cells.
               maForm2->dataGridView1->AutoResizeRows(
                DataGridViewAutoSizeRowsMode::AllCellsExceptHeaders);
                // Set the column header names.
         maForm2->dataGridView1->Columns[ 0 ]->Name = "";
          maForm2->dataGridView1->Columns[ 1 ]->Name = "RAM";
          maForm2->dataGridView1->Columns[ 2 ]->Name = "CPU";
          maForm2->dataGridView1->Columns[ 3 ]->Name = "BAT";


                 maForm2->Show();



                 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

your link doesn't work. Just attach it to your post using the Files tab in the purple ribbon above the editor.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Without seeing all the code it's nearly impossible to tell what your problem is. Delete all compiler-generated files, zip it up, and attach it to your post.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I recevied one vote on one of my posts and got two emails for it dated about 1 minute apart.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

looks like you did not include form3.h in form1.h

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Normlly you would not want to do that. But you could just make the grid Public in the class header file.

manel1989 commented: 555555 +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

43 years ago! Hummmm -- was Dani even born yet? I knew Dani was good -- but didn't know she was that good :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I see from google that Ubuntu has used grub2 since version 9 so Ubuntu will have the same problem.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I didn't get the grub screen until I used ezBCD.exe to add Debian to the menu. I never saw the screen that Debian installed. Windows is the default boot item in the menu, so I used arrow key to change to Debian and hit Enter key. It is at that point I get a bunch of error messages saying that Windows can't start.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have Windows 7 Ultimate installed, then installed most recent version of Debian on an unallocated 100GB partition on the primary drive (on a PC, not on a notebook). That all works without a problem. The problem is that I can not figure out how to change the boot menu to boot with either operating system. I downloaded ezBCD.exe and edited the boot menu to add the Debian os, but when I select it after rebooting I get the error that Windows cannot boot because the files are corrupt (there's lots of other info too that I have forgotten).

When I installed Debian I told it to install grub in the primary boot sector, where I think that is where MS-Windows boot loader is installed.

The only way I can boot into Debian is to use the boot menu of the motherboard bios setup.

Any suggestions how to make the duel-boot menu work?

Thanks

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

post Form21.h

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are at least 2 ways I can think of to write your own string function:

  1. Use a linked list of char arrays for storing the read-in-lines from the file. In a loop read a line, allocate new memory for a new node of the linked list, add the line to the node, then finally add the node to the linked list.

  2. Store all the lines of the file into the same character array -- dynamically expand the character array when each new line is read from the input file. That way you don't have to guess about how big the character array has to be.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sounds like a virus or malware to me. Here's how to use EnumProcesses()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

that and the wifi doesn't work either for lack of a device driver that works on the laptop. I tried ethernet connection and it won't work either. I think I'll just return the laptop from where I bought it and get one that already has linux (Ubuntu?) installed, most likely from where ruberman mentioned earlier today. I contacted Lenovo this afternoon and they are sending me a DVD with the operating system on it so that I can restore it on the laptop.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Are you trying to say Unity won't start?

I don't know what Unity is -- The graphic desktop won't start, AFAIK it's called XServer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I tried Ubuntu 12.<something>, Depian and Mint. None of them can start the Xserver. I have Ubuntu installed right now, and when I type startx it displays a lot of stuff, then quits with "No displays found". I checked ubuntu forums and found my exact same problem here. However when I checked /etc/X11 there is no xorg.conf file. When I run Xorg -configu (link) it displays a list of graphic device drivers then exists with "No screens found".

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

a cat, a dog, 3 fish, 2 kids and 2 grandkids.

<M/> commented: ahh... the children. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why does that thread look sooo bloody awful?