zandiago 115 Nearly a Posting Maven Featured Poster

Thanx....however, after I remove the semi-colon, I receive an error message:

error C2143: syntax error : missing ';'before '}'

That's what i get after compiling the program(it shows up as an error for line 33).

I agree that's the semicolon causing the problem, see below my new code.... and I have two problems:
Why does it only print the profile for "Kenez" from my inFile? Secondly, in my outFile, it only print's out data for "Kenez" and it places the "Letter Grade", for Kenez in a separate line? Below are my inFile & outFile.

zandiago 115 Nearly a Posting Maven Featured Poster

Ok, thx bench, i'll repost my code inna few...imma do sone reading up some more on the struct.

zandiago 115 Nearly a Posting Maven Featured Poster

Please post the specs of your PC...Thnx

zandiago 115 Nearly a Posting Maven Featured Poster

What additional declaration should i give to Comp...but it's an array, or how else could I use 'Comp'.

zandiago 115 Nearly a Posting Maven Featured Poster

Interesting....our professor didn't point out that was what the semicolons do......i owe youo guys big for that tip!!

zandiago 115 Nearly a Posting Maven Featured Poster

Thanx....however, after I remove the semi-colon, I receive an error message:

error C2143: syntax error : missing ';'before '}'

That's what i get after compiling the program(it shows up as an error for line 33).

zandiago 115 Nearly a Posting Maven Featured Poster

Hello there, if you notice that your PC is running slow, it maybe possible that computer is still infected. In addition to viruses, your computer may be infected with spywares, Trojans, worms, adwares and other malwares. Please let us know what type of computer you have and also what anti-virus program you’ve used. Personally, if a PC is infected, I do recommend using more than one antiviris program to help you. My personal recommendation for cleanup softwares are : Adware SE, ACE, Avast, AVG, Mcafee, ParetoLogic XoftSpySE, PREVX and spyware be-gone. Also, I do recommend that you clean/restore your registry files…if these are corrupted, your PC will slow down. The software to help you with your registry: RegCure and Regpair. Some of the above mentioned programs can be downloaded at www.cnet.com. Please use these utilities and let’s know the outcome. Thank you and have a good day. With regards to pop-ups, have you tried simply using a pop-up blocker? The removal of viruses and other malwares does affect your PC registry. Also, there are softwares out there such as “Explorer Repair” that resets your TCP/IP settings, deletes ARP Cache, repair your host files, checks your winsock files . Hopefully, one of the guys will be able to address your log file and get back to you.

zandiago 115 Nearly a Posting Maven Featured Poster

Thanks for the assistance:

If I were to do the following, why does it only show the information for Kenez from my inFile?

10
Gayle 75 82 62 61 59
Brown 79 100 17 19 89
Byles 100 94 81 79 81
Watts 71 22 48 100 17
Walsh 41 85 71 88 81
Ahmed 93 47 76 64 94
Ellis 87 99 100 70 83
Silny 80 76 85 78 81
Simms 88 93 42 84 65
Kenez 75 48 77 69 82
-------------------------------------------------------------------------------

#include<fstream>
#include<iomanip>
#include<string>
#include<iostream>
#include<cmath>

using namespace std;

int main()
{
	int stunum;//# of students in the class
	string stuname;// Name of the student
	float Test1;//score for test 1
	float Test2;//score for test 2
	float Midterm;//score for midterm
	float Final;//score for final
	float Term;//score for term project
	float Grade;
	float NumA=0;
	float NumB=0;
	float NumC=0;
	float NumF=0;

	ifstream inFile;
	ofstream outFile;

	inFile.open ("ClassData.dat");
	outFile.open ("ClassOutput");
	inFile>>stunum;//reads in the # of students in the class
	outFile<<"The # of students in the class:"<<stunum<<endl;
	for (int j=0; j<stunum; j++);
	{
	while (inFile>>stuname>>Test1>>Test2>>Midterm>>Final>>Term);
	}
	outFile<<setw(10)<<"Name"<<setw(10)<<"Test1"<<setw(10)<<"Test2"<<setw(10)<<"Midterm"<<setw(10)<<"Final"<<setw(12)<<"Project"<<setw(14)<<"Total Grade"<<setw(16)<<"Letter Grade"<<endl;
	Grade= Test1+Test2+Midterm+Final+Term;
	
	{
	
		{
			outFile<<setw(10)<<stuname<<setw(10)<<Test1<<setw(10)<<Test2<<setw(10)<<Midterm<<setw(10)<<Final<<setw(10)<<Term<<setw(10)<<Grade<<endl;
	
			{	
				float Grade= Test1+Test2+Midterm+Final+Term;
				if(Grade>=90)
				{
				outFile<<"A ";
				NumA++;
				}
				else if (Grade>=80)
				{
				outFile<<"B ";
				NumB++;
				}
				else if (Grade>=70)
				{
				outFile<<"C ";
				NumC++;
				}
				else if (Grade<70)
				{
				outFile<<"F ";
				NumF++;
				outFile<<endl;
				}
				inFile>>stuname>>Test1>>Test2>>Midterm>>Final>>Term;
				
			}

			outFile<<"The # of A's:"<<NumA<<endl;
			outFile<<"The # of B's:"<<NumB<<endl;
			outFile<<"The # of C's:"<<NumC<<endl;
			outFile<<"The # of F's:"<<NumF<<endl; …
zandiago 115 Nearly a Posting Maven Featured Poster

Since my professor say I SHOULD NOT "break" out of an "for" loop....what is my alternative?

zandiago 115 Nearly a Posting Maven Featured Poster

Since my professor say I should "break" out of an "for" loop....what is my alternative?

zandiago 115 Nearly a Posting Maven Featured Poster

Below is my code: Why does it not print anything out? As you can see in my previous posts, i was using a wile loop, howver, my instructor said i can't use it.

#include<iostream>
#include <string>
#include<fstream>


using namespace std;



int main()
{
	
	ifstream inFile;
	ofstream outFile;

	inFile.open ("random.dat");
	outFile.open ("randout");

	int numbers[91]={0};
    int counter=0;
    int num=0;
    
    inFile>>num;
    
    {
    bool found = false;
    for(int i=0;i<=counter;i++)
    {
            if(numbers[i]==num)
            {
               found=true;
             }
    }
    if(!found)
    {
		cout<<"These are the non-repeating #"<<endl;
        numbers[counter++]=num;
    } 
	inFile>>num;
     }    
    return 0;

}
zandiago 115 Nearly a Posting Maven Featured Poster

“Write a C++ program (use multi-dimensional arrays) that uses an array structures (size 8) to store the following information on a company’s 8 divisions:

Division name (such as East, West, North, South, Northeast, Northwest, Southeast, and Southwest)

First Quarter sales
Second quarter sales
Third quarter sales
Fourth Quarter Sales
Fourth Quarter sales
Total annual sales
Average quarterly sales

Each array element should contain all information about one of the eight divisions (East, West, North, etc.). The user should be asked for the four quarters’ sales figures for each division. (You are allowed to store user input data in an input file, if you wish). Each division’s total and average sales should be calculated and stored in the appropriate member field. Once all data are filled, print a report to a file displaying all information for all 8 divisions.

NB. Print your report in descending order of Average quarterly sales.
Do not allow the user to input negative values for any of the sales figures.”
----------------------------------------------------------------------------------

#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

struct Comp;
float first;
float second;
float third;
float val;
float avg;

string const N = "North Division";
string const S = "South Division";
string const E = "East Division";
string const W = "West Division";
string const NW = "North West Division";
string const NE = "North East Division";
string const SW = " South West Division";
string const SE = " …
zandiago 115 Nearly a Posting Maven Featured Poster

Hello there, if you notice that your PC is running slow, it maybe possible that computer is still infected. In addition to viruses, your computer may be infected with spywares, Trojans, worms, adwares and other malwares. Please let us know what type of computer you have and also what anti-virus program you’ve used. Personally, if a PC is infected, I do recommend using more than one antiviris program to help you. My personal recommendation for cleanup softwares are : Adware SE, ACE, Avast, Mcafee, ParetoLogic XoftSpySE, PREVX and spyware be-gone. Also, I do recommend that you clean/restore your registry files…if these are corrupted, your PC will slow down. The software to help you with your registry: RegCure and Regpair. Some of the above mentioned programs can be downloaded at www.cnet.com. Please use these utilities and let’s know the outcome. Thank you and have a good day.The removal of viruses and other malwares does affect your PC registry.

zandiago 115 Nearly a Posting Maven Featured Poster

Hello there, . In addition to viruses, your computer may be infected with spywares, Trojans, worms, adwares and other malwares. Please let us know what type of computer you have and also what anti-virus program you’ve used. Personally, if a PC is infected, I do recommend using more than one antiviris program to help you. My personal recommendation for cleanup softwares are : Adware SE, ACE, Avast, Mcafee, ParetoLogic XoftSpySE, PREVX and spyware be-gone. Also, I do recommend that you clean/restore your registry files…if these are corrupted, your PC will slow down. The software to help you with your registry: RegCure and Regpair. Some of the above mentioned programs can be downloaded at www.cnet.com. Please use these utilities and let’s know the outcome. Thank you and have a good day.

zandiago 115 Nearly a Posting Maven Featured Poster

You may want to try cleaning your registry

zandiago 115 Nearly a Posting Maven Featured Poster

My personal recommendation for cleanup softwares are : Adware SE and spyware be-gone. With regards to pop-ups, have you tried simply using a pop-up blocker?

zandiago 115 Nearly a Posting Maven Featured Poster

Welcome aboard, all the best in that C++ course, I'm currently doing it..

zandiago 115 Nearly a Posting Maven Featured Poster

Hello there, if you notice that your PC is running slow, it maybe possible that computer is still infected. In addition to viruses, your computer may be infected with spywares, Trojans, worms, adwares and other malwares. Please let us know what type of computer you have and also what anti-virus program you’ve used. Personally, if a PC is infwected, I do recommend using more than one antiviris program to help you. I’ll take a look at your log and let you know later. My personal recommendation for cleanup softwares are : Adware SE, ACE, Avast, Mcafee, ParetoLogic XoftSpySE, PREVX and spyware be-gone. Also, I do recommend that you clean/restore your registry files…if these are corrupted, your PC will slow down. The software to help you with your registry: RegCure and Regpair. Some of the above mentioned programs can be downloaded at www.cnet.com. Please use these utilities and let’s know the outcome. Thank you and have a good day.

zandiago 115 Nearly a Posting Maven Featured Poster

Hello there, what problems are you experiencing so far? Initially, using a computer (with a little knowledge) may seem overwhelming....but in time you'll be fine. Just let us know what difficulties yyou are having and we'll be more than happy to assist you. Cheer up M8.

zandiago 115 Nearly a Posting Maven Featured Poster

Also, would it be possible to use a while loop?

zandiago 115 Nearly a Posting Maven Featured Poster

Sorry for taking so long to reply. My code is as below:

#include<iostream>
#include <string>
#include<fstream>


using namespace std;



int main()
{
	
	ifstream inFile;
	ofstream outFile;

	inFile.open ("random.dat");
	outFile.open ("randout");

	int numbers[91]={0};
    int counter=0;
    int num=0;
    
    inFile>>num;
    while(num!=0)
    {
    bool found = false;
    for(int i=0;i<=counter;i++)
    {
            if(numbers[i]==num)
            {
               found=true;
               break;
            }
    }
    if(!found)
    {
        cout<<num<<" is a non repeating number."<<endl;
        numbers[counter++]=num;
    } 
    outFile<<" "<<endl;
    inFile>>num;

    }    
    return 0;

}

A couple things....
1. Does my use of "while(num!=0)" make a differnce in the programs ability to read in the 1000 numbers?
2. What's wrong with using a break in a 'for' loop and what difference will/does it make?
3. When i take out the line

cout<<num<<" is a non repeating number."<<endl;

...I get a buch on error messages...any reason why?

Thanks for assistance.

zandiago 115 Nearly a Posting Maven Featured Poster

Out of curiosity...how could I design this same program using appropriate functions? Also....let us say that in addition I wanted to print out from the inFile, each of the student's individual test grade...why would it be a redundant code to have this after each if else statement? Also, how could i use a for loop to read the number of students from my inFile(which is on the first line of the inFile):

else if ( gradeAvg < 70 )
{
outFile << stuname << setw ( 5 ) << gradeAvg
<< setw ( 5 ) << "F" << endl;
NumF++;

If i put that each time for each student...why is it redundant.... Is there a way to have only one long-output statement and then print the letter grade separately? Thanks for the assistance...

zandiago 115 Nearly a Posting Maven Featured Poster

When last have you had a virus scan. Malwares(trojans, worms, spyware, adware, key-loggers...ect...) may sometimes change your internet settings. I also recommend for you to clean/repair your registry. Is your internet firewall enabled? What type of computer do you have?

zandiago 115 Nearly a Posting Maven Featured Poster

what exactly happens when you place a CD in? who is the manufacturer of you laptop?

zandiago 115 Nearly a Posting Maven Featured Poster

Good day....couple things-have you checked your registry to get it repaired/cleaned? Have you recently installed any new/incompatible , hardware, software or driver which may deny it from continuing operating properly....

zandiago 115 Nearly a Posting Maven Featured Poster

sorry.....but i'm not familiar with Acer laptops.....however, i reccommend that you get the manual and they should have a couple pages on 'Beep Codes'. Each motherboard may be unique in the sound that is used to specify whats wrong. Is your bios updated? If you've check the inside of your laptop (hard-ware as was in the previous posts)....when did you start having this problem and how long u had the laptop?

zandiago 115 Nearly a Posting Maven Featured Poster

Have you tried using another burning software....such as 'Easy CD creator or windows media player?' By the way who is the manufacturer of your burner drive?

zandiago 115 Nearly a Posting Maven Featured Poster

oh...i see it now....but i still get:
1>------ Build started: Project: lab-6, Configuration: Debug Win32 ------
1>Compiling...
1>lab-6.cpp
1>c:\users\neil\documents\visual studio 2005\projects\lab-6\lab-6\lab-6.cpp(44) : error C2660: 'seenBefore' : function does not take 1 arguments

zandiago 115 Nearly a Posting Maven Featured Poster

bool seenBefore(int, int *);...how can i get it to work?

zandiago 115 Nearly a Posting Maven Featured Poster
1>------ Build started: Project: lab-6, Configuration: Debug Win32 ------
1>Compiling...
1>lab-6.cpp
1>c:\users\neil\documents\visual studio 2005\projects\lab-6\lab-6\lab-6.cpp(44) : error C2660: 'seenBefore' : function does not take 1 arguments
1>c:\users\neil\documents\visual studio 2005\projects\lab-6\lab-6\lab-6.cpp(45) : error C2143: syntax error : missing ';' before '}'
1>c:\users\neil\documents\visual studio 2005\projects\lab-6\lab-6\lab-6.cpp(45) : warning C4390: ';' : empty controlled statement found; is this the intent?
1>c:\users\neil\documents\visual studio 2005\projects\lab-6\lab-6\lab-6.cpp(58) : error C2601: 'seenBefore' : local function definitions are illegal
1>        c:\users\neil\documents\visual studio 2005\projects\lab-6\lab-6\lab-6.cpp(17): this line contains a '{' which has not yet been matched
1>c:\users\neil\documents\visual studio 2005\projects\lab-6\lab-6\lab-6.cpp(69) : fatal error C1075: end of file found before the left brace '{' at 'c:\users\neil\documents\visual studio 2005\projects\lab-6\lab-6\lab-6.cpp(17)' was matched
1>Build log was saved at "file://c:\Users\Neil\Documents\Visual Studio 2005\Projects\lab-6\lab-6\Debug\BuildLog.htm"
1>lab-6 - 4 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
zandiago 115 Nearly a Posting Maven Featured Poster

ok thx

zandiago 115 Nearly a Posting Maven Featured Poster
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <string>
#include<fstream>


using namespace std;


int main()
{
	int num;

	
	ifstream inFile;
	ofstream outFile;

	inFile.open ("random.dat");
	outFile.open ("randout");
	


bool seenBefore(int, int *);

    int seen[91];
    for(int i=0; i<91; i++)
    { // set all bools to false.
        seen[i]=false;
    }
    
    while ( inFile >> num ) 
	{
		{
		if ( !seenBefore(num) )
		}
	
	{
		outFile << "Your non-repitive #'s :"<<num<<endl;
	}
    
    for (int i = 10; i<101; i++)
    { 
        cout << i << " " << seenBefore(i, seen) << "\n";// 0=not seen before, 1 = seen before.
    }
}

bool seenBefore(int num, int *seen)
{
     if(seen[num-10])
     {
         return true;
     }
     
     seen[num-10] = true;
     
	return 0;
}

----------------------------------------------------------------------------------

Why am I receiving the following errors:
'seenBefore' : function does not take 1 arguments
syntax error : missing ';' before '}'
'seenBefore' : local function definitions are illegal

zandiago 115 Nearly a Posting Maven Featured Poster
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <string>
#include<fstream>


using namespace std;


int main()
{
	int num;

	
	ifstream inFile;
	ofstream outFile;

	inFile.open ("random.dat");
	outFile.open ("randout");
	


bool seenBefore(int, int *);

    int seen[91];
    for(int i=0; i<91; i++)
    { // set all bools to false.
        seen[i]=false;
    }
    
    while ( inFile >> num ) 
	{
		outFile << "Your non-repitive #:"<<endl;
		
	}
    
    for (int i = 10; i<101; i++)
    { 
        cout << i << " " << seenBefore(i, seen) << "\n";// 0=not seen before, 1 = seen before.
    }
}

bool seenBefore(int num, int *seen)
{
     if(seen[num-10])
     {
         return true;
     }
     
     seen[num-10] = true;
     
	return 0;
}

----------------------------------------------------------------------------------
Ok....this is what i kinna figured...so couldn't I just let the program check the inFile(which contains the random #'s already) ?to see how much time they appear? But could I adjust this so that when each # is read from the inFile, print it only if it's not a duplicate of a number already read (and printed)?? Thx for all the assistance.

zandiago 115 Nearly a Posting Maven Featured Poster

With regards to the initial post...how could I read each number from the file into a temporary variable, then use a loop to compare it to all of the numbers in the array, until i find a match?

zandiago 115 Nearly a Posting Maven Featured Poster

Wwiii....

zandiago 115 Nearly a Posting Maven Featured Poster
#include <iostream>



using namespace std;


int main()
{
	


bool seenBefore(int, int *);

    int seen[91];
    for(int i=0; i<91; i++)
    { // set all bools to false.
        seen[i]=false;
    }
    
    seenBefore(15,seen); // for testing
    
    for (int i = 10; i<101; i++)
    { // loop thru 10-20
        cout << i << " " << seenBefore(i, seen) << "\n";// 0=not seen before, 1 = seen before.
    }
}

bool seenBefore(int num, int *seen)
{
     if(seen[num-10])
     {
         return true;
     }
     
     seen[num-10] = true;
     
	return 0;
}

---------------------------------------------------------------------------------

I guess that something like this could work.......just need some touch up-i guess. thanks for all the help.

zandiago 115 Nearly a Posting Maven Featured Poster

how could i loop through the elements of the array?

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <string>
#include<fstream>

using namespace std;
bool seenBefore ( int num )
	{
    return false;
	}

int main()
{
	int num;
	int value[1000];
	int range [100-10+1];
	int MIN =10;
	int MAX= 100;
	
	ifstream inFile;
	ofstream outFile;

	inFile.open ("random.dat");
	outFile.open ("randout");

	while ( inFile >> num ) 
	{
		outFile << "Your non-repitive #:"<<endl;
		
	}
	inFile.close();
	outFile.close();

	return 0;
}
zandiago 115 Nearly a Posting Maven Featured Poster

pretty much, the values that are read in from my inFile which contains the 1000 numbers already, the number should only be printed out if it's already been read and printed out...(in other words it shouldn't be a duplicate number)...

zandiago 115 Nearly a Posting Maven Featured Poster
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <string>
#include<fstream>

using namespace std;
bool seenBefore ( int num )
	{
    return false;
	}

int main()
{
	int num;
	int value[1000];
	int range [10, 100];
	
	ifstream inFile;
	ofstream outFile;

	inFile.open ("random.dat");
	outFile.open ("randout");

	while ( inFile >> num ) 
	{
		outFile << "Your non-repitive #:"<<num<<endl;
		
	}
	inFile.close();
	outFile.close();

	return 0;
}

----------------------------------------------------------------------------------
Why do i get the error codes:
1. error C2143: syntax error : missing ']' before ','
2. error C2059: syntax error : 'constant', (where i have the variable range?
3. With regards the seenBefore.....i aint really sure how to get it to work

zandiago 115 Nearly a Posting Maven Featured Poster

It had initially printed that '90' because it was the first number in my inFile.

zandiago 115 Nearly a Posting Maven Featured Poster

actually.....it prints '90'....my mistake...1000 should be the # of ints

zandiago 115 Nearly a Posting Maven Featured Poster

How can i use the array to hold the numbers printed?

zandiago 115 Nearly a Posting Maven Featured Poster
[/TEX] 
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <string>
#include<fstream>

using namespace std;
bool seenBefore ( int num )
	{
    return false;
	}

int main()
{
	int num;
	
	ifstream inFile;
	ofstream outFile;

	inFile.open ("random.dat");
	outFile.open ("randout");

	while ( inFile >> num ) 
	{
		if ( !seenBefore(num) )
	
	{
		outFile << "Your non-repitive #'s :"<<num<<endl;
	}
	inFile.close();
	outFile.close();

}

	return 0;
}[TEX]

----------------------------------------------------------------------------------
Thats what i've got so far. My outFile...shows the number of integers (which is 90)...I've read up on the arrays and still kinna lost...imma read some more and see...Thx for all the help.

zandiago 115 Nearly a Posting Maven Featured Poster

Glad that I could could help...but as a precaution i'd recommend enabling your firewall and diagnosing your pc with the softwares that i mentioned in my first post....no one software is the ultimate...some will pick-up thing others won't and vice versa...so after completing such diagnostics, lemme know the results.

zandiago 115 Nearly a Posting Maven Featured Poster

Try using the sotwares that i indicated in my first response. i do strongly recommend enabling your windows firewall. Svchost may often show up in errors caused by viruses. What % does it use on ur PC? I also reccm that you keep ur computer update. i.e. if you have windows...keep it update by microsoft by enabling 'auto-update'. There are still definately traces of virus on your computer.

zandiago 115 Nearly a Posting Maven Featured Poster

i've got all the numbers as was required an placed then in an inFile. With regards to if/else statements, how could i make the program so that if the number is a duplicate it wont print it out?

zandiago 115 Nearly a Posting Maven Featured Poster

The blue screen has to mainly do with hard-ware conflicts....in more severe cases, i think it can also it's a case of a faulty mother board. Additionally, the blue screen can be caused by; faulty memory, a corrupt Registry, or incompatible DLLs. There are softwares out there that can be used to diagnose the prob mentioned above it it's the registry.
Regards.

zandiago 115 Nearly a Posting Maven Featured Poster

The blue screen has to mainly do with hard-ware conflicts....in more severe cases, i think it can also it's a case of a faulty mother board. Additionally, the blue screen can be caused by; faulty memory, a corrupt Registry, or incompatible DLLs. There are softwares out there that can be used to diagnose the prob mentioned above it it's the registry.
Regards.

zandiago 115 Nearly a Posting Maven Featured Poster

Check the resolution size and the physical settings(for your monitor)..

zandiago 115 Nearly a Posting Maven Featured Poster

Good day.....a couple things.....You can definately install a pop-up blocker to see if that works...in additional to virus removal, i recommend the following...a thorough scan for trojans, worms, malwares, adwares, spywares. After removing viruses ect...i would recommend reparing/cleaning your registry (with REGCURE software). My reccomendations for all your other malwares ect...Adware, spyware begone, Avast cleaner, Ace cleanup, ParetoLogic XoftSpySE, PREVX are just of the few you can try.
2nd. Also, there are some non-legitimate anti-virus programs that will try to install themselves onto your PC...do not install them...if you run then on your computer and you do a scan...it will detect itself as being a virus.
3rd. I need to know if your internet firewall has been disabled and is your computer slowing down?