+ 2
C++
Hello guys, can anyone here help me to solve the first C++ project. This is my first time experience in programming and I don’t know what to do or how to start it
28 Answers
+ 12
Learn C
+ 6
Omar Saad can you show your code?
+ 5
Abol thank you brother
+ 5
No need to learn c before c++ .. just focus on 1 Language and do practice sidewise .
+ 4
Follow the C++ tutorial carefully.
+ 4
Sonic I wrote the code and my answer is exactly as the example in the project, but it still gives me that my answer is wrong, I don‘t know how to do it
+ 4
Me khud nai hu mere ko khud ko samjh nahi aaraha hai ki is ko use kysy kro...
+ 4
#include <iostream>
using namespace std;
int main() {
//your code goes here
int a;
cin>>a;
cout<<50-(a%50);
return 0;
}
+ 4
Mohammad sefatullah plz don't spam here.
+ 4
Martin, thats true... if/else needs to be added in that instance
x = Passengers % 50;
If(x == 0) then...
Else....
+ 3
Sonic yes off course, but do you know the project?, if you know it i‘ll copy my code here to show it to you and if there is any mistakes you can help me to correct it
+ 3
Omar Saad well if it's a long project I'm not sure. If it's a small code snippet, maybe.
+ 3
sonic has everythin right
however i would make 1 change, try
Int left = max - remaining
Or 50 - remaining
after input goes through modulus ofcourse like sonic said
+ 2
Sonic no it is a very small project but I cant solve it yet, it shows how much I‘m unexperienced, here is the code
this is the project:
You are making a program for a bus service.
A bus can transport 50 passengers at once.
Given the number of passengers waiting in the bus station as input, you need to calculate and output how many empty seats the last bus will have.
Sample Input:
126
Sample Output:
24
Explanation: The first bus will transport 50 passengers, leaving 126-50=76 in the station. The next one will leave 26 in the station, thus, the last bus will take all of the 26 passengers, having 50-26=24 seats left empty.
this is my code:
#include <iostream>
using namespace std;
int main() {
//your code goes here
int maximum = 50;
int npass;
std::cout << " Enter the number of passengers \n";
std::cin >> npass;
int remaining = npass%maximum;
int left = remaining - maximum;
std::cout << " The of left empty seats is: " << left << std::endl;
return 0;
}
+ 2
#include <iostream>
using namespace std;
int main() {
//your code goes here
int n, empty_seat;
cin>>n;
//maxmium passenger that can travel in bus is 50
if (n <= 50)
{
empty_seat = 50-n;
cout<<empty_seat;
}
else
{
n = (n%50);
empty_seat = 50-n;
cout<<empty_seat;
}
return 0;
}
+ 2
7
+ 1
You should learn c language first.
0
#include <iostream>
using namespace std;
These thing are important in the first
0
gfvycfygtucudcufulit
0
Oh sut