0% found this document useful (0 votes)
160 views

University of Gondar Institute of Technology: C++ Programming-2 Assignment

This C++ program contains two assignments from the University of Gondar Institute of Technology for the Department of Industrial Engineering. The first assignment involves writing a program to calculate the current of a semiconductor diode based on inputs of saturation current, diode voltage, and temperature. The second assignment involves writing a program to output student information in a tabular format with specific formatting rules for columns, widths, justification, and empty columns.

Uploaded by

Tigabu Yaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
160 views

University of Gondar Institute of Technology: C++ Programming-2 Assignment

This C++ program contains two assignments from the University of Gondar Institute of Technology for the Department of Industrial Engineering. The first assignment involves writing a program to calculate the current of a semiconductor diode based on inputs of saturation current, diode voltage, and temperature. The second assignment involves writing a program to output student information in a tabular format with specific formatting rules for columns, widths, justification, and empty columns.

Uploaded by

Tigabu Yaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

UNIVERSITY OF GONDAR

INSTITUTE OF TECHNOLOGY

C++ PROGRAMMING-2 ASSIGNMENT


DEPARTMENT OF INDUSTRIAL ENGINEERING

NAME-FEBENMENGISTU
ID NO - 01273/12

Submit date 15/11/2014


Summited to Mr. Tigabu
1.8 The general characteristics of semiconductor diode can be defined by the following equation

#include <iostream>
#include<cmath>
using namespace std;

int main()
{

double Is,Vd,Tk,Id,k;
k=11600;
cout<<"enter the saturation current in ampere"<<endl;
cin>>Is;
if(pow(10,-15)<Is && Is<pow(10,-9))
{
cout<<"correct value"<<endl;
}
else
{
cout<<"Invalid Is value"<<endl;
return 0;
}
cout<<"Enter the Diod voltage in volts"<<endl;
cin>>Vd;
if(0<Vd && Vd<1)
{
cout<<"correct value"<<endl;
}
else
{
cout<<"Invalid Vd value"<<endl;
return 0;
}
cout<<"Enter the temprature in kelvin"<<endl;
cin>>Tk;
if(223<Tk && Tk<423)
{
cout<<"correct value"<<endl;
}
else
{
cout<<"Invalid Tk value";
return 0;
}
Id=Is*(exp((k*Vd)/Tk)-1);
cout<<"the value of the diod current is: "<<Id;
return 0;

1.9. Write a program that prints the student information in a table. The information includes
the name of the student, his/her department, ID, number, age, Stream, preference research
interest and current CGPA. The output shall be presented in a tabular form with the following
rules: the maximum significant digit shall be 2, the width of each column shall be 20, and the
unoccupied columns of the table shall be filled with “-” and the columns shall be left justified.3

#include <iostream>
#include<string>
#include<iomanip>
using namespace std;

int main()
{
string name,name2,name3,department,department2,department3,stream,stream2,stream3,pri,pri2,pri3;
int ID,ID2,ID3,age,age2,age3;
float cgpa,cgpa2,cgpa3;
cout<<"NAME"<<endl;
cin>>name;
cout<<"DEPARTMENT"<<endl;
cin>>department;
cout<<"ID"<<endl;
cin>>ID;
cout<<"AGE"<<endl;
cin>>age;
cout<<"STREAM"<<endl;
cin>>stream;
cout<<"PRI"<<endl;
cin>>pri;
cout<<"CGPA"<<endl;
cin>>cgpa;
cout<<"NAME 2"<<endl;
cin>>name2;
cout<<"DEPARTMENT 2"<<endl;
cin>>department2;
cout<<"ID 2"<<endl;
cin>>ID2;
cout<<"AGE 2"<<endl;
cin>>age2;
cout<<"STREAM 2"<<endl;
cin>>stream2;
cout<<"PRI 2"<<endl;
cin>>pri2 ;
cout<<"CGPA 2"<<endl;
cin>>cgpa2;
cout<<"NAME 3"<<endl;
cin>>name3;
cout<<"DEPARTMENT 3"<<endl;
cin>>department3;
cout<<"ID 3"<<endl;
cin>>ID3;
cout<<"AGE 3"<<endl;
cin>>age3;
cout<<"STREAM 3"<<endl;
cin>>stream3;
cout<<"PRI 3"<<endl;
cin>>pri3;
cout<<"CGPA 3"<<endl;
cin>>cgpa3;
cout
<<setfill('-')
<<left
<<setw(20)
<<"Name";
cout
<<setfill('-')
<<left
<<setw(20)
<<"department";
cout
<<setfill('-')
<<left
<<setw(20)
<<"ID";
cout
<<setfill('-')
<<left
<<setw(20)
<<"age";
cout
<<setfill('-')
<<left
<<setw(20)
<<"stream";
cout
<<setfill('-')
<<left
<<setw(20)
<<"PRI";
cout
<<"cgpa"<<endl<<endl;
cout
<<setfill('-')
<<left
<<setw(20)
<<name;
cout
<<setfill('-')
<<left
<<setw(20)
<<department;
cout
<<setfill('-')
<<left
<<setw(20)
<<ID;
cout
<<setfill('-')
<<left
<<setw(20)
<<age;
cout
<<setfill('-')
<<left
<<setw(20)
<<stream;
cout
<<setfill('-')
<<left
<<setw(20)
<<pri;
cout
<<cgpa<<endl;
cout
<<setfill('-')
<<left
<<setw(20)
<<name2;
cout
<<setfill('-')
<<left
<<setw(20)
<<department2;
cout
<<setfill('-')
<<left
<<setw(20)
<<ID2;
cout
<<setfill('-')
<<left
<<setw(20)
<<age2;
cout
<<setfill('-')
<<left
<<setw(20)
<<stream2;
cout
<<setfill('-')
<<left
<<setw(20)
<<pri2;
cout
<<cgpa2<<endl;
cout
<<setfill('-')
<<left
<<setw(20)
<<name3;
cout
<<setfill('-')
<<left
<<setw(20)
<<department3;
cout
<<setfill('-')
<<left
<<setw(20)
<<ID3;
cout
<<setfill('-')
<<left
<<setw(20)
<<age3;
cout
<<setfill('-')
<<left
<<setw(20)
<<stream3;
cout
<<setfill('-')
<<left
<<setw(20)
<<pri3;
cout
<<cgpa3<<endl;
return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy