Click here to Skip to main content
16,003,417 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
#include <iostream>
#include<string>
using namespace std ;
struct NodeType 
{
	string Name ;
	int Grade ;
	NodeType *Link ;
};
class TotalLinkedList 
{
private :
	NodeType *Pass ;
	NodeType *Fail ;
	int CountPass ;
	int CountFail ;

public :
	void insert (string , int ) ;
	void deleteNode (int);
	int searchName(string);
	string FindMax () ;
	double PrintAverage ();
	void Print();
	TotalLinkedList ();
	~TotalLinkedList();
	TotalLinkedList (TotalLinkedList&);
};
TotalLinkedList::TotalLinkedList() 
{
	Pass = 0 ;
	Fail = 0 ;
	CountPass =0 ;
	CountFail = 0; 
}
void TotalLinkedList::insert (string name ,int grade )
{
  NodeType *P ,*F , *C=new NodeType , *D=new NodeType ;
  P=new NodeType ;
  F= new NodeType ;
 
  if (grade >=50&&grade<=100 )
  {
	  if (Pass==0)
		  Pass=P;
       P->Grade = grade ;
	   P->Name=name ;
	   P->Link = Pass ;
	  P->Link =Pass ;
	  CountPass++ ;
      for ( int i=0 ; i<countpass mode="hold" />	  { 
		  C=C->Link ;
		  C->Link =P ;
		  P->Link = Pass ;
		  Pass = P ; }}
  else 
	 
	  if (grade <=50 &&grade>0 )
  {
	  if (Fail==0)
		  Fail=F;
       F->Grade = grade ;
	   F->Name=name ;
	   F->Link = Fail ;
	  F->Link =Fail ;
	  CountFail++ ;
	  
	  C=0;

      for ( int i=0 ; i<countfail mode="hold" />	  { 
		  C=C->Link ;
		  C->Link =F ;
		  F->Link = Fail ;
		 Fail = F ; }}
	  else 
		  cout <<" Can not insert " << endl;

}
int TotalLinkedList::searchName(string name)
{

	for(int i=0 ; i<countpass;i++)>
	{
		if(Pass->Name==name)
			return Pass->Grade;
		else 
			if (Fail->Name==name)
				return Fail->Grade ;
	}
}
 
string TotalLinkedList:: FindMax () 
{
	 
	NodeType *C=Pass;
	int Max = Pass->Grade ;
	for (int i=0;i<countpass;i++)>
	{
		
		
		if (C->Grade>Max)
			Max=C->Grade;
		
		C=C->Link;
		
	}
	return C->Name ; 
}




double TotalLinkedList::PrintAverage ()
{
	int sum1=0,sum2=0 , SUM=0 , average;
	for (int i=0 ; i<countpass;i++)>
	{
		sum1=sum1 + Pass->Grade ;
	}
	for (int i=0 ; i<countfail;i++)>
	{
		sum2=sum2 + Fail->Grade ;
	}
	SUM=sum1+sum2;
		average = SUM/(CountPass+CountFail) ;
		return average ;
}
void TotalLinkedList::Print()
{
	NodeType *c ;
	c=Pass;
	for (int i =0 ;i<countpass;i++)>
	{
		cout << c->Name << " " << c->Grade ;
		c=c->Link ;
	}
	c=0;
	c=Fail;
	for (int i =0 ;i<countfail;i++)>
	{
		cout << c->Name << " " << c->Grade ;
		c=c->Link ;
	}

}
TotalLinkedList::~TotalLinkedList()
{
	delete Pass ;
	delete Fail ;

}

int main ()
{
	TotalLinkedList Obj1 ;
	Obj1.insert("Ali" , 90 );
	Obj1.insert("Rhmad" , 44 );
	Obj1.insert("Ruba" , 103 );
	Obj1.insert("Majd" , 77 );
	Obj1.insert("Huda" , 85 );
	Obj1.insert("Kamel" ,39 );
	Obj1.insert("Ola" , -5 );
	Obj1.insert("Eman" , 90 );
	

	return 0 ;
}

I get this error
LINK : warning LNK4081: insufficient disk space; linking nonincrementally
Posted
Updated 1-Nov-12 9:36am
v2
Comments
CpeBoshra 1-Nov-12 15:35pm    
and this warning
LINK : warning LNK4081: insufficient disk space; linking nonincrementally
joshrduncan2012 1-Nov-12 15:36pm    
What lines of your code is the compiler pointing to?
CpeBoshra 1-Nov-12 15:40pm    
this is build solutions
------ Build started: Project: assign2_20110171036, Configuration: Debug Win32 ------
Compiling...
boshra_20110171036.cpp
g:\assign2_20110171036\assign2_20110171036\boshra_20110171036.cpp(92) : warning C4715: 'TotalLinkedList::searchName' : not all control paths return a value
Compiling manifest to resources...
Linking...
LINK : warning LNK4081: insufficient disk space; linking nonincrementally
Embedding manifest...
LINK : warning LNK4081: insufficient disk space; linking nonincrementally
Build log was saved at "file://g:\assign2_20110171036\assign2_20110171036\Debug\BuildLog.htm"
assign2_20110171036 - 0 error(s), 3 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped
joshrduncan2012 1-Nov-12 15:44pm    
Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped

This means nothing is wrong. Are you not getting the correct output?
CpeBoshra 1-Nov-12 15:49pm    
I am not getting output

There are a couple of things here:
LINK : warning LNK4081: insufficient disk space; linking nonincrementally
Means you should seriously check how much disk space you have - if it can't link that, then you are running out very fast - or your software is messed up and may need a re-install.

Secondly, you won't get any output - unless something goes wrong.
You main function creates a linked list, adds items to it and exits - it doesn't try to output anything and as far as I can see, the insert function only outputs anything if there is a problem.

BTW: Sort out your indentation. Fix it up before you post again so it is easy to read your code - it makes it simpler for us, and simpler for you!
 
Share this answer
 
It looks like you're running out of disk space on drive G:

How much free disk space does drive G: have?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900