Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as text by asasd ( 17 years ago )
#include <iostream>	// stream-handling
#include <iomanip>	// stream-formatting
#include <string>	// string-class

using namespace std;

int main()
{ /*
	int iErste, iZweite, iSumme;
	double iQuotient;
	double dSumme, dQuotient;
	double dSummeCast,dQuotientCast;
	
//------------------ Aufgabe 2.5. 1. bis 3.-------------------------	
	//Eingabe
	cin >> iErste;
	cin >> iZweite;
	
	//Rechnung
	iSumme = iErste + iZweite;
	iQuotient =  iErste / iZweite;
	
	dSumme = iErste + iZweite;
	dQuotient = iErste / iZweite;		
	
	dSummeCast = (double)iErste + (double)iZweite;
	dQuotientCast = (double)iErste / (double)iZweite;
	
	
	// Ausgabe
	cout<< "iSumme = "<< iSumme <<endl;
	cout<< "iQuotient = " << iQuotient <<endl;
	cout<< "dSumme = "<< dSumme <<endl;
	cout<< "dQuotient = "<< dQuotient <<endl;
	cout<< "dSummeCast = "<< dSummeCast <<endl;
	cout<< "dQuotientCast = "<< dQuotientCast <<endl;
	
////------------------ Aufgabe 2.5. 4-------------------------	*/
	string sVorname, sNachname, sVornameName, sNameVorname;
	//Eingabe
	cout<< "Vorname eingeben"<<endl;
	cin >> sVorname;
	cout<< "Nachname eingeben"<<endl;
	cin >> sNachname;
	//Zusammenf&Atilde;&frac14;gen									// + f&Atilde;&frac14;hrt strings zusammen
	sVornameName = sVorname + " " + sNachname;		// " "  F&Atilde;&frac14;r Leerzeichen zwischen Vorname und Nachname
	sNameVorname = sNachname +", "+  sVorname;		// ", " F&Atilde;&frac14;r Komma zwischen Nachname und Vorname
	//Ausgabe
	cout<< sVornameName<<endl;
	cout<<sNameVorname;
cout<< " "<<endl;
	
////------------------ Aufgabe 2.5. 5-------------------------	
	// Block erstellen 
	/*
	{	cout<< "_________________ "<<endl;
	
		int i,x,iZweite;
		iZweite = 1;
		
		// Erstellen der Felder
		int iFeld[2] = { 1, 2 };							  //Ansprechen mit den Indizes  0 und 1 
		int Spielfeld[3][3] = { {1,2,3} , {4,5,6} , {7,8,9} }; // Ansprechen mit von z.B 3 mit 4
		
		//Ausgabe von iFeld
		for ( i = 0; i < 2; i++) {cout<< iFeld[i]<<endl;}
		cout<< "_________________ "<<endl;
		
		//Ausgabe Spielfeld
		for ( i = 0; i < 3; i++){ 
			for( x = 0; x < 3; x++){
				cout<<Spielfeld[i][x]<<endl;
			}
		}
		
	cout<<"iZweite = "<<iZweite<<endl;
	} 

////------------------ Aufgabe 2.5. 6-------------------------	*/
//97 - 122	Buchstaben Klein a - z
//65 - 90	Buchstaben Gro&Atilde;Ÿ A - Z
//48 - 58	Ziffern Null bis Neun

	int iName1, iName2;
	int stelle1 , stelle2;
									
	iName1 =sVorname[0];
	iName2 =sVorname[1];
	
	// 1 Stelle berechnen
	if ( (iName1 <= 90) && (iName1 >= 65) ) //Wenn iName1 kleiner gleich 90 und gr&Atilde;&para;&Atilde;Ÿer gleich 65
	{
	 	stelle1 = iName1 + 26 - 90; 
	}
	if ( (iName1 <= 97) && (iName1 >= 122) )
	{
		stelle1 = iName1 + 26 - 122;		// Bsp c = 99   99 + 26 - 122 = 3 Stelle
	}
	
	// 2 Stelle berechnen
	if ( (iName2 <= 90) && (iName2 >= 65) ) //Wenn iName2 kleiner gleich 90 und gr&Atilde;&para;&Atilde;Ÿer gleich 65
	{
	 	stelle2 = iName2 + 26 - 90; 
	}
	if ( (iName2 <= 97) && (iName2 >= 122) )
	{
		stelle2 = iName2 + 26 - 122;
	}
	

	cout<< "iName1 = "<< iName1<<endl;
	cout<< "iName2 = "<< iName2<<endl;
	cout<< "Der Buchstabe "<< sVorname[0]<<" befindet sich an der "<< stelle1 <<" Stelle im Alphabet."<<endl;
	cout<< "Der Buchstabe "<< sVorname[1]<<" befindet sich an der "<< stelle2 <<" Stelle im Alphabet."<<endl;


	
cout<< " "<<endl;
cout<< " "<<endl;	
return 0;
}

 

Revise this Paste

Your Name: Code Language: