Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Learning Aids/Tools 2 years ago
Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I am new learning C++ and I have basic questions and basic troubles :(
I want to print a list of numbers that are coming from the next following while condition:
int list=0; while (list<100){ list=list+r; }
I want to use printf instead of cout (because I still don´t know why with cout is not working).
Can anyone help me to give me the analogous printf command to
cout<<list<<"\t";
Thanks a lot!!!
Here is a small sample program which counts up to 100 in increments of 10.
I use both std::cout and printf to display the value of list in each increment.
std::cout
printf
list
Comments added to hopefully help aid you in learning
#include #include dio> int main() { int r = 10; int list=0; while (list < 100) { list += r; // this is the same as saying list = list + r, but is more succinct std::cout << list << "\t"; // cout is in the std namespace, so you have to prefix with std:: printf("%d\n", list); // the printf format specified for int is "%d" } }
Output:
10 10 20 20 30 30 40 40 50 50 60 60 70 70 80 80 90 90 100 100
Please note that I didn't use using namespace std; at the top to import cout into the global namespace. IMHO this is bad practice, so I typically will prefer std::cout etc.
using namespace std;
cout
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.