Learn how to use the puts() function to display student information in a C program.
To write a C/C++ program that displays a student's Name, School Name, and Address using the puts() function.
puts() function
In this practical, you will use the puts() function to display student information. The puts() function is a simple way to output strings in C programming. It automatically adds a newline after each string, making it perfect for displaying multiple lines of text.
The puts() function takes a single argument — a string (character array) — and displays it on the screen. It is part of the stdio.h library.
puts() automatically adds a newline at the end of each string, so you don't need to use \n.
Run the program:
Expected Output:
puts() automatically adds a newline after each string.puts() function is used to display strings on the screen.puts() statement displays one string and automatically moves to the next line.puts() is simpler than printf() when you only need to display strings.\n with puts().
You have successfully written a C program that displays a student's Name, School Name, and Address using the puts() function. You have learned how puts() can be used to display multiple lines of text easily.
puts() automatically adds a newline character after each string. This makes it perfect for displaying information line by line.
puts(""); to print a blank line. This is useful for adding spacing between lines of output.
ایک C/C++ پروگرام لکھنا جو puts() فنکشن کا استعمال کرتے ہوئے طالب علم کا نام، سکول کا نام اور پتہ ظاہر کرتا ہے۔
puts() فنکشن کی بنیادی معلومات
اس عملی میں، آپ طالب علم کی معلومات ظاہر کرنے کے لیے puts() فنکشن کا استعمال کریں گے۔ puts() فنکشن C پروگرامنگ میں سٹرنگز آؤٹ پٹ کرنے کا ایک آسان طریقہ ہے۔ یہ ہر سٹرنگ کے بعد خود بخود نئی لائن شامل کرتا ہے، جو متعدد لائنوں کا متن ظاہر کرنے کے لیے بہترین ہے۔
puts() فنکشن ایک ہی دلیل لیتا ہے — ایک سٹرنگ (کریکٹر اری) — اور اسے اسکرین پر ظاہر کرتا ہے۔ یہ stdio.h لائبریری کا حصہ ہے۔
puts() ہر سٹرنگ کے آخر میں خود بخود نئی لائن شامل کرتا ہے، لہذا آپ کو \n استعمال کرنے کی ضرورت نہیں ہے۔
پروگرام چلائیں:
متوقع آؤٹ پٹ:
puts() ہر سٹرنگ کے بعد خود بخود نئی لائن کیسے شامل کرتا ہے۔puts() فنکشن اسکرین پر سٹرنگز ظاہر کرنے کے لیے استعمال ہوتا ہے۔puts() بیان ایک سٹرنگ ظاہر کرتا ہے اور خود بخود اگلی لائن پر چلا جاتا ہے۔puts() printf() سے آسان ہے جب آپ کو صرف سٹرنگز ظاہر کرنی ہوں۔puts() کے ساتھ \n استعمال کرنے کی ضرورت نہیں ہے۔
آپ نے کامیابی سے ایک C پروگرام لکھا ہے جو puts() فنکشن کا استعمال کرتے ہوئے طالب علم کا نام، سکول کا نام اور پتہ ظاہر کرتا ہے۔ آپ نے سیکھ لیا ہے کہ puts() کو کس طرح متعدد لائنوں کا متن آسانی سے ظاہر کرنے کے لیے استعمال کیا جا سکتا ہے۔
puts() ہر سٹرنگ کے بعد خود بخود نئی لائن کا کریکٹر شامل کرتا ہے۔ یہ معلومات کو لائن بہ لائن ظاہر کرنے کے لیے بہترین ہے۔
puts(""); استعمال کر سکتے ہیں۔ یہ آؤٹ پٹ کی لائنوں کے درمیان فاصلہ شامل کرنے کے لیے مفید ہے۔