Title (c++)

Posts 1–15 of 17 · Page 1 of 2
Title (c++)
I googled 30 minutes in german and in english and didnt found the code for making a title O.o but I hope you guys help me. I just want to make a simple title for my c++ programm.
SetWindowText()
Link: SetWindowText Function ()

I am not going to paste the full code here, because I don't want you to just copy and paste it, but make an initiative to figure it out. It is far more satisfying when you figure something out for youself rather than someone else doing it for you.
SetWindowText should definately set you in the right direction.

If you ever do need the full answer, check my blog, I will put the full code there. But only check if youve really made a significant effort to find the answer for yourself.

Good luck.
thx for your fast answer but im not making a window application im making a consol application
Hehe, even easier.
SetConsoleTitle("My Title");
thx
you helped me a lot
lol just noticed we got similar avatars
Quote Originally Posted by greathamza View Post
lol just noticed we got similar avatars
xDD


but back to c++. I get a error when i compile the programm

Code:
//IWife von Matthew Stahlke und Fridi B.
#include <iostream>

int main()
{
    SetConsoleTitle("IWife von Matthew Stahlke und Fridi B.");
	int xx;
	std::cout << "Wie geht es dir?." << std::endl;
	std::cout << "1.Sehr gut" << std::endl;
	std::cout << "2.Gut" << std::endl;
	std::cout << "3.Normal" << std::endl;
	std::cout << "4.Schlecht" << std::endl; 
	std::cout << "5.Traurig" << std::endl;
	std::cout << "6.Meine Freundin hat mich verlassen" << std::endl; 
	std::cout << "7.Ich weiss nicht wie ich mich fuehle" << std::endl;
	std::cout << "8.Ich hab endlich eine freundin :D" << std::endl;
	std::cout << "9.Ich will mich umbringen" << std::endl;
	std::cout << "10.Ich glaube ich werde ein Zombie" << std::endl;
	std::cout << "11.Ein Zombie will in mein Zimmer" << std::endl;
	std::cout << "12.ICH BIN GESTRESST!!!" << std::endl;
	std::cin >> xx;
	
	if (xx == 1)
	{
		std::cout << "Ich freue mich fuer dich :D" << std::endl;
	}
	else if (xx == 2)
	{
		std::cout << "Das ist doch mal was gutes :D" << std::endl;
	}
    else if (xx == 3)
	{
		std::cout << "Ist heute nichts besonderes passiert? Naja besser als schlecht :|" << std::endl;
	}
	else if (xx == 4)
	{
		std::cout << "OH, das ist aber schlecht :(" << std::endl;
	}
	else if (xx == 5)
	{
		std::cout << "Komm ich weine mit dir *heul*" << std::endl;
	}
	else if (xx == 6)
	{
		std::cout << "LOL was hast du fuer Stoerungen ?!" << std::endl;
		std::cout << "Du hast eine Freundin und benutzt so welche programme die dich fragen wie es dir geht ?! Get a live, freak!" << std::endl;
	}
	else if (xx == 7)
	{
		std::cout << "WTF?! O.o" << std::endl;
	}
	else if (xx == 8)
	{
		std::cout << "Na dann loesch mich doch endlich^^" << std::endl;
	}
	else if (xx == 9)
	{
		std::cout << "Wenn du springen willst dann geh nach New York" << std::endl;
		std::cout << "Wenn du ein Strick brauchst geh zum Baumarkt" << std::endl;
		std::cout << "Wenn du eine 9mm brauchst dann geh zum Waffenladen" << std::endl;
	}
		if (xx == 10)
	{
		std::cout << "An deiner stelle wuerde ich zum casting fuer den naechsten Resident Evil gehen." << std::endl;
	}
	if (xx == 11)
	{
		std::cout << "Regel Nummer 1 immer auf den Kopf zielen." << std::endl;
		std::cout << "Regel Nummer 2 immer zweimal drauf hauen oder schiessen." << std::endl;
	}
	if (xx == 12)
	{
           std::cout << "Komm geh rauchen Junge und halt mich nich mit deinen problemen auf." << std::endl;
    }
	system("pause");
}
and when i compile it like this, i also get an error

Code:
//IWife von Matthew Stahlke und Fridi B.
#include <iostream>
SetConsoleTitle("IWife von Matthew Stahlke und Fridi B.");

int main()
{
	int xx;
	std::cout << "Wie geht es dir?." << std::endl;
	std::cout << "1.Sehr gut" << std::endl;
	std::cout << "2.Gut" << std::endl;
	std::cout << "3.Normal" << std::endl;
	std::cout << "4.Schlecht" << std::endl; 
	std::cout << "5.Traurig" << std::endl;
	std::cout << "6.Meine Freundin hat mich verlassen" << std::endl; 
	std::cout << "7.Ich weiss nicht wie ich mich fuehle" << std::endl;
	std::cout << "8.Ich hab endlich eine freundin :D" << std::endl;
	std::cout << "9.Ich will mich umbringen" << std::endl;
	std::cout << "10.Ich glaube ich werde ein Zombie" << std::endl;
	std::cout << "11.Ein Zombie will in mein Zimmer" << std::endl;
	std::cout << "12.ICH BIN GESTRESST!!!" << std::endl;
	std::cin >> xx;
	
	if (xx == 1)
	{
		std::cout << "Ich freue mich fuer dich :D" << std::endl;
	}
	else if (xx == 2)
	{
		std::cout << "Das ist doch mal was gutes :D" << std::endl;
	}
    else if (xx == 3)
	{
		std::cout << "Ist heute nichts besonderes passiert? Naja besser als schlecht :|" << std::endl;
	}
	else if (xx == 4)
	{
		std::cout << "OH, das ist aber schlecht :(" << std::endl;
	}
	else if (xx == 5)
	{
		std::cout << "Komm ich weine mit dir *heul*" << std::endl;
	}
	else if (xx == 6)
	{
		std::cout << "LOL was hast du fuer Stoerungen ?!" << std::endl;
		std::cout << "Du hast eine Freundin und benutzt so welche programme die dich fragen wie es dir geht ?! Get a live, freak!" << std::endl;
	}
	else if (xx == 7)
	{
		std::cout << "WTF?! O.o" << std::endl;
	}
	else if (xx == 8)
	{
		std::cout << "Na dann loesch mich doch endlich^^" << std::endl;
	}
	else if (xx == 9)
	{
		std::cout << "Wenn du springen willst dann geh nach New York" << std::endl;
		std::cout << "Wenn du ein Strick brauchst geh zum Baumarkt" << std::endl;
		std::cout << "Wenn du eine 9mm brauchst dann geh zum Waffenladen" << std::endl;
	}
		if (xx == 10)
	{
		std::cout << "An deiner stelle wuerde ich zum casting fuer den naechsten Resident Evil gehen." << std::endl;
	}
	if (xx == 11)
	{
		std::cout << "Regel Nummer 1 immer auf den Kopf zielen." << std::endl;
		std::cout << "Regel Nummer 2 immer zweimal drauf hauen oder schiessen." << std::endl;
	}
	if (xx == 12)
	{
           std::cout << "Komm geh rauchen Junge und halt mich nich mit deinen problemen auf." << std::endl;
    }
	system("pause");
}
It would help a lot if you can show us the errors. Anyway, SetConsoleTitle() should be in the main function. Try that.
Well there are more errors and i use dev c++ you cant really copy them all^^ but i have errors again

Code:
//IWife von Matthew Stahlke und Fridi B.
#include <iostream>

int main()
{
    SetConsoleTitle("IWife") 
	int xx;
	std::cout << "Wie geht es dir?" << std::endl;
	std::cout << "1.Sehr gut" << std::endl;
	std::cout << "2.Gut" << std::endl;
	std::cout << "3.Normal" << std::endl;
	std::cout << "4.Schlecht" << std::endl; 
	std::cout << "5.Traurig" << std::endl;
	std::cout << "6.Meine Freundin hat mich verlassen" << std::endl; 
	std::cout << "7.Ich weiss nicht wie ich mich fuehle" << std::endl;
	std::cout << "8.Ich hab endlich eine freundin :D" << std::endl;
	std::cout << "9.Ich will mich umbringen" << std::endl;
	std::cout << "10.Ich glaube ich werde ein Zombie" << std::endl;
	std::cout << "11.Ein Zombie will in mein Zimmer" << std::endl;
	std::cout << "12.ICH BIN GESTRESST!!!" << std::endl;
	std::cout << "13.Impressum" << std::endl;
	std::cin >> xx;
	
	if (xx == 1)
	{
		std::cout << "Ich freue mich fuer dich :D" << std::endl;
	}
	else if (xx == 2)
	{
		std::cout << "Das ist doch mal was gutes :D" << std::endl;
	}
    else if (xx == 3)
	{
		std::cout << "Ist heute nichts besonderes passiert? Naja besser als schlecht :|" << std::endl;
	}
	else if (xx == 4)
	{
		std::cout << "OH, das ist aber schlecht :(" << std::endl;
	}
	else if (xx == 5)
	{
		std::cout << "Komm ich weine mit dir *heul*" << std::endl;
	}
	else if (xx == 6)
	{
		std::cout << "LOL was hast du fuer Stoerungen ?!" << std::endl;
		std::cout << "Du hast eine Freundin und benutzt so welche programme die dich fragen wie es dir geht ?! Get a live, freak!" << std::endl;
	}
	else if (xx == 7)
	{
		std::cout << "WTF?! O.o" << std::endl;
	}
	else if (xx == 8)
	{
		std::cout << "Na dann loesch mich doch endlich^^" << std::endl;
	}
	else if (xx == 9)
	{
		std::cout << "Wenn du springen willst dann geh nach New York" << std::endl;
		std::cout << "Wenn du ein Strick brauchst geh zum Baumarkt" << std::endl;
		std::cout << "Wenn du eine 9mm brauchst dann geh zum Waffenladen" << std::endl;
	}
	else if (xx == 10)
	{
		std::cout << "An deiner stelle wuerde ich zum casting fuer den naechsten Resident Evil gehen." << std::endl;
	}
	else if (xx == 11)
	{
		std::cout << "Regel Nummer 1 immer auf den Kopf zielen." << std::endl;
		std::cout << "Regel Nummer 2 immer zweimal drauf hauen oder schiessen." << std::endl;
	}
	else if (xx == 12)
	{
           std::cout << "Komm geh rauchen Junge und halt mich nich mit deinen problemen auf." << std::endl;
    }
    else if (xx == 13)
    {
         std::cout << "Gescriptet und ideen von Matthew Stahlke. Ideen von Fridi B." << std::endl;
    }
    else
    {
        std::cout << "Bitte waehle eine Nummer zwischen 1 und 13." << std::endl;
    }
	system("pause");
}
Post all of your errors. It's a lot easier on us, and quicker.
C:\Users\Applesouce\Desktop\C++\IWife.cpp In function `int main()':
6 C:\Users\Applesouce\Desktop\C++\IWife.cpp `SetConsoleTitle' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
7 C:\Users\Applesouce\Desktop\C++\IWife.cpp expected `;' before "int"
22 C:\Users\Applesouce\Desktop\C++\IWife.cpp `xx' undeclared (first use this function)

Code:
//IWife von Matthew Stahlke und Fridi B.
#include <iostream>

int main()
{ 
    SetConsoleTitle("IWife")
	int xx;
	std::cout << "Wie geht es dir?" << std::endl;
	std::cout << "1.Sehr gut" << std::endl;
	std::cout << "2.Gut" << std::endl;
	std::cout << "3.Normal" << std::endl;
	std::cout << "4.Schlecht" << std::endl; 
	std::cout << "5.Traurig" << std::endl;
	std::cout << "6.Meine Freundin hat mich verlassen" << std::endl; 
	std::cout << "7.Ich weiss nicht wie ich mich fuehle" << std::endl;
	std::cout << "8.Ich hab endlich eine freundin :D" << std::endl;
	std::cout << "9.Ich will mich umbringen" << std::endl;
	std::cout << "10.Ich glaube ich werde ein Zombie" << std::endl;
	std::cout << "11.Ein Zombie will in mein Zimmer" << std::endl;
	std::cout << "12.ICH BIN GESTRESST!!!" << std::endl;
	std::cout << "13.Impressum" << std::endl;
	std::cin >> xx;
	
	if (xx == 1)
	{
		std::cout << "Ich freue mich fuer dich :D" << std::endl;
	}
	else if (xx == 2)
	{
		std::cout << "Das ist doch mal was gutes :D" << std::endl;
	}
    else if (xx == 3)
	{
		std::cout << "Ist heute nichts besonderes passiert? Naja besser als schlecht :|" << std::endl;
	}
	else if (xx == 4)
	{
		std::cout << "OH, das ist aber schlecht :(" << std::endl;
	}
	else if (xx == 5)
	{
		std::cout << "Komm ich weine mit dir *heul*" << std::endl;
	}
	else if (xx == 6)
	{
		std::cout << "LOL was hast du fuer Stoerungen ?!" << std::endl;
		std::cout << "Du hast eine Freundin und benutzt so welche programme die dich fragen wie es dir geht ?! Get a live, freak!" << std::endl;
	}
	else if (xx == 7)
	{
		std::cout << "WTF?! O.o" << std::endl;
	}
	else if (xx == 8)
	{
		std::cout << "Na dann loesch mich doch endlich^^" << std::endl;
	}
	else if (xx == 9)
	{
		std::cout << "Wenn du springen willst dann geh nach New York" << std::endl;
		std::cout << "Wenn du ein Strick brauchst geh zum Baumarkt" << std::endl;
		std::cout << "Wenn du eine 9mm brauchst dann geh zum Waffenladen" << std::endl;
	}
	else if (xx == 10)
	{
		std::cout << "An deiner stelle wuerde ich zum casting fuer den naechsten Resident Evil gehen." << std::endl;
	}
	else if (xx == 11)
	{
		std::cout << "Regel Nummer 1 immer auf den Kopf zielen." << std::endl;
		std::cout << "Regel Nummer 2 immer zweimal drauf hauen oder schiessen." << std::endl;
	}
	else if (xx == 12)
	{
           std::cout << "Komm geh rauchen Junge und halt mich nich mit deinen problemen auf." << std::endl;
    }
    else if (xx == 13)
    {
         std::cout << "Gescriptet und ideen von Matthew Stahlke. Ideen von Fridi B." << std::endl;
    }
    else
    {
        std::cout << "Bitte waehle eine Nummer zwischen 1 und 13." << std::endl;
    }
	system("pause");
}
For your first error, include windows.h

For your second error, you have to put a semi colon after everything in C++, or almost everything.
[php]
SetConsoleTitle("blah");
[/php]

You must have missed it, but you should have been able to figure that one out.

Hopefully adding the semi colon as mentioned above will solve your last error as well.
It works now thank you so much I will know now how i put titles
not really related to c++, but did u put in all of that German or did u copy paste it from a translator? because alot of the word order is fucked up, no offense.
Quote Originally Posted by nubs View Post
not really related to c++, but did u put in all of that German or did u copy paste it from a translator? because alot of the word order is fucked up, no offense.

An dieser antwort erkenne ich das du deutsch sprichst und ich auch^^ mein englisch ist "fucked up" aber mein deutsch ist eigentlich ganz gut

(natürlich darfst du ab nummer 5 die antworten nicht mehr an "Wie geht es dir" anhängen...)

PS: Ich habe "Wie geht es dir" zu "Sag mir wie du dich fühlst und ich antworte dir" geändert
Posts 1–15 of 17 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?