any formula to share?

I need to do a mini project that needs to include of and else. I really can't think of any formula to use for the if and else. someone please help!!
You really can't think of anything to do with an if-else? How about doing different things based on user input? Are you stuck on something that is preventing you from programming what you want to program?
i am supposed to write a program that involved if and else.
So are you stuck on anything? Is there something you don't understand about your assignment?
i need input. but i can't think of any.
Input...from the console with std::cin? How about a number? A letter? A word?
printf("Is the circuit parallel or series");

what should my scanf be?
This is a forum for C++, and although C++ supports C, you shouldn't use C. It would be much easier to use standard C++ input/output streams, such as std::cin and std::cout.
1
2
3
std::cout << "Is the circuit parallel or series?" << std::endl;
std::string MyStandardStringVariable;
std::cin >> MyStandardStringVariable;

You need to #include <string> to use std::string. Then you can just check if the string equals "parallel" or if it equals "series", else they enetered invalid input.
Last edited on
Topic archived. No new replies allowed.