Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- string team;
- string name1;
- string name2;
- string name3;
- string tmp;
- int ID1;
- int ID2;
- int ID3;
- int num;
- void NAME(){
- int i ;
- i = 0;
- while(i<4){
- cout << i << endl;
- if(i==0){
- cout << "Please enter your team: " << endl;
- getline(cin,tmp);
- team = tmp;
- } //if
- else{
- cout << "Please enter your name: " << endl;
- getline(cin,tmp);
- if(i==1)
- name1 = tmp;
- else if(i==2)
- name2 = tmp;
- else if(i==3)
- name3 = tmp;
- } //else
- i++;
- }
- cout << "*****Print Name*****" << endl;
- cout << team << endl;
- cout << name1 << endl;
- cout << name2 << endl;
- cout << name3 << endl;
- cout << "*****End Print*****" << endl;
- }
- void ID() {
- int i = 1;
- cout << "*****Input ID*****" << endl;
- while(i<4){
- cout << "** Please Enter Member " << i << " ID **" << endl;
- cin >> num ;
- if(i==1)
- ID1 = num;
- else if(i==2)
- ID2 = num;
- else if(i==3)
- ID3 = num;
- i++;
- } //while
- num = num + ID1 + ID2 + ID3 ;
- cout << "** Please Enter Command **" << endl;
- cin >> tmp;
- if(tmp == "p"){
- cout << "*****Print Team Member ID and ID Summation*****" << endl;
- cout << ID1 << endl << ID2 << endl << ID3 << endl;
- cout << "ID Summation = " << num << endl;
- cout << "*****End Print*****" << endl;
- } //if()
- } //ID()
- int main()
- {
- string input;
- while(true){
- cout <<" Press 0 to quit" << endl;
- cout << "Press 1 to do Function 1(NAME)" << endl;
- cout << "Press 2 to do Function 2(ID)" << endl;
- cout << "Press 3 to do Main Function" << endl;
- getline(cin, input);
- if(input =="0")
- break;
- else if(input =="1")
- NAME();
- else if(input =="2")
- ID();
- else if(input =="3"){
- cout << "*****Print All*****" << endl;
- cout << team << endl ;
- cout << ID1 << " " << name1 << endl;
- cout << ID2 << " " << name2 << endl;
- cout << ID3 << " " << name3 << endl;
- cout << "ID Summation = " << num << endl;
- cout << "*****End Print*****" << endl;
- }
- else
- cout << "Please try again." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement