\Device\NUL
Msd
In derived class
Getline (cin, stream);
Is not accepting from users just displaying and skip to next step
Why this happening please say anyone
\Device\NUL
Msd
remained newline on input stream ?
I can't share pic otherwise I will show
It showing like
Enter the stream of the student : Enter the mark of the student :
In stream it's not asking user to enter just showing and goes to next step
\Device\NUL
Msd
\Device\NUL
Msd
\Device\NUL
Msd
Msd
But it is in the derived class
Msd
It won't work ?
Bobur
Guys could you help me with this one ?
Bobur
A is an integer vector of 5 elements, A[0], A[1],,, A[4].
Assign different integer values to the 5 elements, print A components.
int A[]= {3, 5,,,,,} can be used.
Calculate average of the five elements.
Aman
Can anyone plzz Send me the syntax of Switch statement
%Nikita
Aman
No i want the authentic one i m unable to find
Dima
lol
Robert
So funny
Robert
What's the authentic one
the best for everyone
klimi
yes
who are "them"?
Dima
authentic switch lmao
gotta make a book and call it like that
Bereket
class Book
{
private:
string title;
string author;
int pages;
public:
Book(string title, string author, int pages)
{
title = title;
author = author;
pages = pages;
};
string gettitle() { return title; };
string getauthor() { return author; };
int getpages() { return pages; };
void print()
{
cout << "title " << gettitle() << endl;
cout << "author " << getauthor() << endl;
cout << "pages " << getpages() << endl;
};
};
int main()
{
Book harrypotter("harry potter", "jk.rowling", 200);
Book dertogada("dertogada", "Yismake Worku", 300);
harrypotter.print();
}
Bereket
Abdulwahab
I was having an error, the code hasn't run, can someone please help me to rectify the error?
Abdulwahab
I was having an error, the code hasn't run, can someone please help me to rectify the error?
}
/* A program to calculate the sum of even numbers and odd numbers from 1 to
10*/
#include <iostream>
int main()
{
int sumOfEven;
int sumOfOdd;
for(int i=1; i <= 10; i++)
{
if(i % 2 == 0)
{
sumOfEven += 1;
}
else
{
sumOfOdd += 1;
}
}
cout<<"Sum of even number = " <<sumOfEven<<endl;
cout<<"Sum of odd number = " <<sumOfOdd<<endl;
return (0);
}
Артем
Артем
And don't forget about std
Abdulwahab
Артем
Or just std::cout, etc.
Dima
ye, using namespace std is bad
Dima
get used to it
\Device\NUL
artemetra 🇺🇦
\Device\NUL
#nousingstd
レッギ
Dima
don't you dare to post it again
Abdulwahab
Abdulwahab
Thank you sir
the best for everyone
// Insertion Sort
#include <stdio.h>
void Insertion_Sort(int a[], int length)
{
// two loops the first one to go to each elements of the numbers
// and the second one to shift to right position and to go to the suitable place of it
int temp, whole;
for (int i = 1; i < length; i++) // it will start form 1 when it puck up it
{
temp = a[i]; // it will get it out for temporary to compare it with the others
whole = whole - 1; // becuase it will start form right to left and it will subtract a number of elements of the index
// and as long as they are subtracting
while (whole > 0 && a[whole - 1] > temp)
{
a[whole] = a[whole - 1]; // to shift to from right to left position and to go to the suitable place of it
whole = whole - 1; // to fix it and make it much better again (to update it )
}
a{whole + 1} = temp;
}
}
int main()
{
int a[] = {8, 4, 9, 5, 7, 6, 3, 2};
Insertion_Sort{a, 8}; // the size of it or the length of it
for (int i = 1; i < 8; i++)
printf("a[%d] = %d \n", i a[i]);
return 0;
}
I am talking about this code
the best for everyone
what is the mistake in it
the best for everyone
someone told me I cant use this argument with c language
the best for everyone
so what could I use
or the mistake
Grigoriy
Hello. Help please. I make public inheritance but place inherited members in protected section. Is this wrong? Is this allowed by c++ standards?
Msd
Grigoriy
class TObserver
{
public:
virtual void notify(void) = 0;
};
class TWorkerImpl : public TObserver // public, not protected!!!
{
protected:
virtual void notify(void) override {}
public:
void doWork1(void) {};
void doWork2(void) {};
};
Grigoriy
I have to use public inheritance because of shared pointers
Maruthi
Can anyone share c language course
Maruthi
I am a beginner
Any internship aslo
Please help me
Anonymous
char FPS[] = "FPS";
sprintf(FPS, "%d FPS", GetFPS());
Anonymous
is there any better way to do this?
Anonymous
getfps returns an integer
%Nikita
Joo
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct Pair {
string name;
double val;
};
vector<Pair>pairs;
double& value(const string& s){
for(int i=0; i<pairs.size(); i++)
if(s==pairs[i].name)
return pairs[i].val;
Pair p={s,0};
pairs.push_back(p);
return pairs[pairs.size()-1].val;
}
int main(){
string buf;
while(cin>>buf) {
value(buf)++;
}
for(vector<Pair>::const_iterator p=pairs.begin(); p!=pairs.end(); ++p){
cout<<p->name<<": "<<p->val<<'\n';
}
return 0;
}
Joo
Can someone help me with this code
Joo
It is stuck on the while loop
Joo
Also, If someone could explain the value function to me I would be glad
Anonymous
moyo
/warn
Anonymous
Hello guys
Anonymous
I need someone to do a job for me ??
Sarmat
Guys, can you please help me. I need a something like a tutorial or a practice work to improve my std library skills.
Some video, like creating messenger on c++, or creating application, or smth like this.
klimi
No way, as well mime how you talk
Mime how I talk? .... Sorry but you have PFP that scammers like to have, you have only one name and your bio says "talk only about crypto"... You are just suspicious
Anonymous
Anonymous
If anyone can work of blockchain development
We can work together
Mohamed Ahmed
cout << +!!!!"2";
Mohamed Ahmed
why the output will be 1 ??
\Device\NUL
Since the address it's not zero then
!!!0
!!1
!0
1
\Device\NUL
like this
const char *str = "2"
std::cout << !!!!str ;